Delete the files from mac system connected by windows.

A

Arihan Sinha

Hi All,

I wanted to do the following actions.Delete some files from a location
in windows and mac system .

System1 ( win 7) ----> System2 (Win 7) which is working fine

pwd = Dir.pwd
Dir.chdir("\\\\System2\\C$\\Users\\TeamCity\\AppData\\Local\\Google\\Chrome\\User
Data\\Default")
FileUtils.rm_r Dir.glob('*'),:force => true
Dir.chdir(pwd)

System1 ( win 7 ) -----> System3 (MAC with Leopard 10.5)


I am trying to access the folder of the mac system by using window
explorer in my system1 and navigate to the
\\System3\Users\teamcity\Library but its not successful.

Note:- the "teamcity" is the user name in the system1 and exactly same
name in the mac system as well as userid.

Workaround:- though I am using now PuTTY like
puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i "C:\\Program Files
(x86)\\TamCity\\.ssh\\authorized_key.ppk"
(e-mail address removed) "pwd"]
where the above command executed from System1

which is working ok and retrieving results as /Users/developer

(e-mail address removed) :- where developer is the current logged
in user to the mac system (i.e developers-iMac.local)

can anyone please guide me so that I can access the folders in Mac like
\\System3\Users\teamcity\Library.

Then It would be easy for me to use Dir.chdir and move on


Cheers
Arihan
 
R

Rilindo Foster

Mac is Unix, so the file path is going to be different - it's a forward =
slash, rather than backslash:
Errno::ENOENT: No such file or directory - \Users\rilindo\src\test
from (irb):3:in `chdir'
from (irb):3


Hi All,
=20
I wanted to do the following actions.Delete some files from a location
in windows and mac system .
=20
System1 ( win 7) ----> System2 (Win 7) which is working fine
=20
pwd =3D Dir.pwd
= Dir.chdir("\\\\System2\\C$\\Users\\TeamCity\\AppData\\Local\\Google\\Chrom=
e\\User
Data\\Default")
FileUtils.rm_r Dir.glob('*'),:force =3D> true
Dir.chdir(pwd)
=20
System1 ( win 7 ) -----> System3 (MAC with Leopard 10.5)
=20
=20
I am trying to access the folder of the mac system by using window
explorer in my system1 and navigate to the
\\System3\Users\teamcity\Library but its not successful.
=20
Note:- the "teamcity" is the user name in the system1 and exactly same
name in the mac system as well as userid.
=20
Workaround:- though I am using now PuTTY like
puts %x[c:\\Program Files (x86)\\PuTTY\\plink -i "C:\\Program Files
(x86)\\TamCity\\.ssh\\authorized_key.ppk"
(e-mail address removed) "pwd"]
where the above command executed from System1
=20
which is working ok and retrieving results as /Users/developer
=20
(e-mail address removed) :- where developer is the current = logged
in user to the mac system (i.e developers-iMac.local)
=20
can anyone please guide me so that I can access the folders in Mac = like
\\System3\Users\teamcity\Library.
=20
Then It would be easy for me to use Dir.chdir and move on
=20
=20
Cheers
Arihan
=20
--=20
Posted via http://www.ruby-forum.com/.
=20
 
A

Arihan Sinha

Rilindo Foster wrote in post #957435:
Mac is Unix, so the file path is going to be different - it's a forward
slash, rather than backslash:

Errno::ENOENT: No such file or directory - \Users\rilindo\src\test
from (irb):3:in `chdir'
from (irb):3


|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||||||||||||||||||||||||||||||



I tried with above code but no result.

System1: WinXP logged in with username :- teamcity

System2:- MAC system (ip=172.20.10.65) with lepard 10.5 and logged in
with username:- developer
Can you please try the similar way and let me know the output

C:\Documents and Settings\TeamCity>irb
irb(main):001:0> Dir.pwd
=> "C:/Documents and Settings/TeamCity"
irb(main):002:0> Dir.chdir("172.20.10.65/Users/developer/Library")
Errno::ENOENT: No such file or directory -
172.20.10.65/Users/developer/Library
from (irb):2:in `chdir'
from (irb):2
irb(main):003:0> Dir.pwd
=> "C:/Documents and Settings/TeamCity"
irb(main):004:0> Dir.chdir("/172.20.10.65/Users/developer/Library")
Errno::ENOENT: No such file or directory -
/172.20.10.65/Users/developer/Library

from (irb):4:in `chdir'
from (irb):4
irb(main):005:0> Dir.pwd
=> "C:/Documents and Settings/TeamCity"
irb(main):006:0>
 
J

Jeremy Bopp

Hi All,

I wanted to do the following actions.Delete some files from a location
in windows and mac system .

System1 ( win 7) ----> System2 (Win 7) which is working fine

pwd = Dir.pwd
Dir.chdir("\\\\System2\\C$\\Users\\TeamCity\\AppData\\Local\\Google\\Chrome\\User
Data\\Default")
FileUtils.rm_r Dir.glob('*'),:force => true
Dir.chdir(pwd)

Not really addressing your question, but here is a simplified version of
what you're doing:

Dir.chdir("\\\\System2\\C$\\Users\\TeamCity\\AppData\\Local\\Google\\Chrome\\User
Data\\Default") do
FileUtils.rm_r Dir.glob('*'),:force => true
end
System1 ( win 7 ) -----> System3 (MAC with Leopard 10.5)


I am trying to access the folder of the mac system by using window
explorer in my system1 and navigate to the
\\System3\Users\teamcity\Library but its not successful.

What error do you receive when attempting to access that location using
the Windows file explorer? Have you enabled any sort of
Windows-compatible file sharing on your Mac? Is authentication required
in order to access any shares your Mac may be providing?

I can't do much more than provide general hand waving when it comes to
Macs since I've never used OSX myself, unfortunately. Hopefully, these
questions can get you started moving in the right direction.

-Jeremy
 
J

Jeremy Bopp

Mac is Unix, so the file path is going to be different - it's a forward slash, rather than backslash:

Errno::ENOENT: No such file or directory - \Users\rilindo\src\test
from (irb):3:in `chdir'
from (irb):3
=> "/Users/rilindo/src/test"

This will only apply if the Ruby script is actually run on the Mac
itself rather than on the Windows system. The OP is trying to run the
script on Windows while accessing the directory to be processed on the
Mac via Windows file sharing. The backslashes are appropriate in this
case; however, Windows /will/ use backslashes and forward slashes mostly
interchangeably. :)

-Jeremy
 
J

Jeremy Bopp

System1: WinXP logged in with username :- teamcity

System2:- MAC system (ip=172.20.10.65) with lepard 10.5 and logged in
with username:- developer
Can you please try the similar way and let me know the output

C:\Documents and Settings\TeamCity>irb
irb(main):001:0> Dir.pwd
=> "C:/Documents and Settings/TeamCity"
irb(main):002:0> Dir.chdir("172.20.10.65/Users/developer/Library")
Errno::ENOENT: No such file or directory -
172.20.10.65/Users/developer/Library
from (irb):2:in `chdir'
from (irb):2
irb(main):003:0> Dir.pwd
=> "C:/Documents and Settings/TeamCity"
irb(main):004:0> Dir.chdir("/172.20.10.65/Users/developer/Library")
Errno::ENOENT: No such file or directory -
/172.20.10.65/Users/developer/Library

from (irb):4:in `chdir'
from (irb):4
irb(main):005:0> Dir.pwd
=> "C:/Documents and Settings/TeamCity"
irb(main):006:0>

Remember that you're using Windows to access a remote share using
Windows file sharing. That means you need to use a UNC path to access
the share, and a UNC path begins with either \\ or //. What you
attempted above wouldn't even work if the system at 172.20.10.65 was a
Windows system instead of a Mac. ;-)

-Jeremy
 
A

Arihan Sinha

Jeremy Bopp wrote in post #957531:
Remember that you're using Windows to access a remote share using
Windows file sharing. That means you need to use a UNC path to access
the share, and a UNC path begins with either \\ or //. What you
attempted above wouldn't even work if the system at 172.20.10.65 was a
Windows system instead of a Mac. ;-)

-Jeremy

#########################


For windows system I am using this which is working ok .. System1(
windows) to system2 ( windows) where ruby is running in system1 only..(
ruby need not to be installed in system2 because i am only accssing the
files from system2)

irb(main):004:0* Dir.pwd
=> "C:/Documents and Settings/TeamCity" # system1 path
<Dir.chdir("\\\\squish-vista-x86(system2)\\C$\\Users\\TeamCity\\AppData")
=> 0
irb(main):006:0> Dir.pwd
=> "//squish-vista-x86/C$/Users/TeamCity/AppData" #system2 path
irb(main):007:0>

Now the similar way I am looking for Mac where the system2 is Mac (
172.20.10.65)

so how would i change the dir from system1 to Mac system.

I want to go to the 172.20.10.65(this is mac system
IP)/Users/teamcity/Library

If you find the exact solution then pls let me know.

Cheers
A
 
J

Jeremy Bopp

Jeremy Bopp wrote in post #957531:

#########################


For windows system I am using this which is working ok .. System1(
windows) to system2 ( windows) where ruby is running in system1 only..(
ruby need not to be installed in system2 because i am only accssing the
files from system2)

irb(main):004:0* Dir.pwd
=> "C:/Documents and Settings/TeamCity" # system1 path
<Dir.chdir("\\\\squish-vista-x86(system2)\\C$\\Users\\TeamCity\\AppData")
=> 0
irb(main):006:0> Dir.pwd
=> "//squish-vista-x86/C$/Users/TeamCity/AppData" #system2 path
irb(main):007:0>

Now the similar way I am looking for Mac where the system2 is Mac (
172.20.10.65)

so how would i change the dir from system1 to Mac system.

I want to go to the 172.20.10.65(this is mac system
IP)/Users/teamcity/Library

If you find the exact solution then pls let me know.

As I mentioned in one of my other responses in this thread, I don't have
a Mac and can only provide general guidance. First, make sure that
whatever passes for Windows file sharing is enabled on the Mac. Next,
check that you can use the Windows file explorer on system1 to access
whatever path you want to access on the Mac. If it doesn't work at this
point, go back and keep debugging until it does.

Once you can use standard tools to access the data on the Mac, you can
drop into Ruby to do your work without any extra effort, similar to
accessing system2.

-Jeremy
 
H

Heesob Park

Hi,

2010/10/28 Arihan Sinha said:
Jeremy Bopp wrote in post #957531:

#########################


For windows system I am using this which is working ok .. System1(
windows) to system2 ( windows) where ruby is running in system1 only..(
ruby need not to be installed in system2 because i am only accssing the
files from system2)

irb(main):004:0* Dir.pwd
=3D> "C:/Documents and Settings/TeamCity" # system1 path
<Dir.chdir("\\\\squish-vista-x86(system2)\\C$\\Users\\TeamCity\\AppData")
=3D> 0
irb(main):006:0> Dir.pwd
=3D> "//squish-vista-x86/C$/Users/TeamCity/AppData" #system2 path
irb(main):007:0>

Now the similar way I am looking for Mac where the system2 is Mac (
172.20.10.65)

so how would i change the dir from system1 to Mac system.

I want to go to the 172.20.10.65(this is mac system
IP)/Users/teamcity/Library

If you find the exact solution then pls let me know.
You need to setup SMB File Sharing on Mac.
Refer to http://macs.about.com/od/filesharing/ss/file-sharing-with-snow-leo=
pard-win7.htm

Regards,
Park Heesob
 
A

Arihan Sinha

Heesob Park wrote in post #957794:
Hi,


You need to setup SMB File Sharing on Mac.
Refer to
http://macs.about.com/od/filesharing/ss/file-sharing-with-snow-leopard-= win7.htm

Regards,
Park Heesob

#########################

Thanks everyone. I've done with lot of struggle since from yesterday. =

Its very straight forward though same way for other windows systems .No =

forward or back slash confusion:)

windows to window system

irb(main):004:0* Dir.pwd
=3D> "C:/Documents and Settings/TeamCity" # system1 path
<Dir.chdir("\\\\squish-vista-x86(system2)\\C$\\Users\\TeamCity\\AppData")=

=3D> 0
irb(main):006:0> Dir.pwd
=3D> "//squish-vista-x86/C$/Users/TeamCity/AppData" #system2 path
irb(main):007:0>


window to mac sys

C:\Users\arihan.sinha>irb
irb(main):001:0>
irb(main):002:0*
irb(main):003:0* Dir.pwd
=3D> "C:/Users/arihan.sinha"
irb(main):004:0> Dir.chdir("\\\\DEVELOPERS-IMAC\\arihan.sinha\\Library")
=3D> 0
irb(main):005:0> Dir.pwd
=3D> "//DEVELOPERS-IMAC/arihan.sinha/Library"
irb(main):006:0>

-- =

Posted via http://www.ruby-forum.com/.=
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top