Re: Modified "modification date"
Re: Modified "modification date"
- Subject: Re: Modified "modification date"
- From: Axel Luttgens <email@hidden>
- Date: Fri, 11 Dec 2009 11:19:07 +0100
Le 11 déc. 2009 à 05:39, ba95 a écrit :
>
> Le 10 déc. 09 à 21:00, email@hidden a écrit :
>
>> Date: Thu, 10 Dec 2009 08:13:53 -0600
>> From: Luther Fuller <email@hidden>
>> Subject: Re: Modified "modification date"
>> To: Applescript Users <email@hidden>
>> Message-ID: <email@hidden>
>> Content-Type: text/plain; charset="us-ascii"
>>
>> I use ...
>>
>> do shell script "cp -np " & sourcePath & space & targetPath
>>
>> to copy files and the modification date is preserved.
>> I've also verified that drag & drop also preserves the modification date.
>>
>> I haven't tried the Finder's 'duplicate' or 'move' commands.
>> If you are using one of these, it may be the source of your problem.
>
> Thanks Luther.
> You may have solved the problem.
> I am going to check it and I will tell you.
>
> I confirm that "manual" drag and drop preserves the modification date.
>
> The snippet to change is:
> --
> set XXX to folder "HD:Applications:xxx:"
> set YYY to folder "BUdisk:Backupss:yyy:"
> duplicate XXX to YYY with replacing
> --
> Could you explain the command line a little more so that I can use it, please ?
>
>
>> do shell script "cp -np " & sourcePath & space & targetPath
>
> will become
>
> do shell script "cp -np " & XXX & space & YYY
>
> "cp-np" ?
cp is the historical name that has been given to the copy command.
-np are options passed to the command; they could also be passed separately, as in (note the spaces):
cp -n -p
Option -n means "do not overwrite an existing destination file".
Option -p requires to preserve as many attributes (amongst them the modification time) as possible.
As a general rule, such commands are documented through manual pages.
For example, to get help about the cp command, just type:
man cp
at the prompt in Terminal.app.
> space ?
The shell interpreter needs to be able to distinguish the various pieces of a command: the command's name itself, the possible options, the possible arguments...
The space character is commonly used as separator.
If you are ready for a long yet entertaining reading:
man bash
> Is "XXX" going to replace "YYY" ?
Well, things are a bit more complicated, since it appears from the above that you want to copy a directory, not a single file.
This requires to specify the -R option (R for "Recursive"); but that option has a rather special semantics and may require to read the man page several times... ;-)
Should you want to perform the above command in the shell, you would very likely type something like this (note the trailing slash on the source directory):
cp -pR /Applications/xxx/ /Volumes/Udisk/Backupss/yyy
To prepare the string representing the shell command to be executed through "do shell script", you would thus additionally need "POSIX path" and "quoted form of".
But I would suggest to first try to understand the Finder problem you brought up before going further along the "do shell script" path.
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden