Delete the files from mac system connected by windows

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"
developer@developers-iMac.local "pwd"]
where the above command executed from System1

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

developer@developers-iMac.local :- 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

···

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

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

Dir.chdir("\\Users\\rilindo\\src\\test")

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

Dir.chdir("/Users/rilindo/src/test")

=> 0

Dir.pwd

=> "/Users/rilindo/src/test"

···

On Oct 27, 2010, at 5:54 AM, Arihan Sinha wrote:

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"
developer@developers-iMac.local "pwd"]
where the above command executed from System1

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

developer@developers-iMac.local :- 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

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

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

···

On 10/27/2010 4:54 AM, Arihan Sinha wrote:

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:

Dir.chdir("\\Users\\rilindo\\src\\test")

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

Dir.chdir("/Users/rilindo/src/test")

=> 0

Dir.pwd

=> "/Users/rilindo/src/test"

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>

···

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

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. :slight_smile:

-Jeremy

···

On 10/27/2010 5:27 AM, Rilindo Foster wrote:

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

Dir.chdir("\\Users\\rilindo\\src\\test")

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

Dir.chdir("/Users/rilindo/src/test")

=> 0

Dir.pwd

=> "/Users/rilindo/src/test"

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. :wink:

-Jeremy

···

On 10/27/2010 6:22 AM, Arihan Sinha wrote:

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>

Jeremy Bopp wrote in post #957531:

···

On 10/27/2010 6:22 AM, Arihan Sinha wrote:

Errno::ENOENT: No such file or directory -
        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. :wink:

-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

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

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

···

On 10/28/2010 06:10 AM, Arihan Sinha wrote:

Jeremy Bopp wrote in post #957531:

On 10/27/2010 6:22 AM, Arihan Sinha wrote:

Errno::ENOENT: No such file or directory -
        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. :wink:

-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.

Hi,

···

2010/10/28 Arihan Sinha <arihan_sinha@yahoo.com>:

Jeremy Bopp wrote in post #957531:

On 10/27/2010 6:22 AM, Arihan Sinha wrote:

Errno::ENOENT: No such file or directory -
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. :wink:

-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.

You need to setup SMB File Sharing on Mac.
Refer to Set Up Your Mac's File Sharing Options

Regards,
Park Heesob

Heesob Park wrote in post #957794:

···

Hi,

2010/10/28 Arihan Sinha <arihan_sinha@yahoo.com>:

the share, and a UNC path begins with either \\ or //. What you

ruby need not to be installed in system2 because i am only accssing the
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
Set Up Your Mac's File Sharing Options

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
=> "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>

window to mac sys

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

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