but this doens't deal with if source contains directories with subdirectories, correct?
thanks!
It's tricky, but it does deal with subdirectories.
Assume, that NAS was set to /usr4/nas, and the first file returned by find was /usr4/nas/2010/pic1.jpg. The result of this line of the script:
sets STR to 2010/pic1.jpg. The meaning of ${variable##pattern} is to remove the longest occurance of pattern from the front of the contents of variable. The variable file would have been /usr4/nas/2010/pic1.jpg and the value of $NAS would have been /usr4/nas, so the result is everything after /usr4/nas/, or 2010/pic1.jpg which includes the subdirectory.
Assuming XBMC was set to /xbmc, and taking it further
would test to see if /xbmc/2010/pic1.jpg existed -- properly assuming the directory structure from the source filesystem exists on the target filesystem. Likewise, the copy command assumes the same directory structure on the target filesystem. (It does assume that the directory structure exists on the target.)
There are two things that I would tweek:
First, use find piped to while rather than assuming that the output of the find command can be handled as a list to for.
Secondly, assuming Kshell or Bash, use [[ ]] to supply the test expression rather than the single bracket. The double bracketed expressions are more efficient because the evaluation is done by the shell and not by an external command (test).
In addition, if the script should make the directories on the target that don't exist, the following needs to be added:
This should go immediately before the copy.
Last edited by agama; 08-16-2010 at 08:37 PM..
Reason: corrected silly typos
I am writing a program to display a database to the screen(xterm) and want to allow the window resize signal to increase/decrease the amount data that is displayed. I have a signal handler function for catching the SIGWINCH event and calling a function to reallocate the space for the windows... (0 Replies)
Hi,
I have 4 solaris 9(32-Bit) Sparc machines on the same subnet.
All 4 of them have different times( off by 10-15 mins).
I need to synchronize all 4 of them.
Please advise what I should do to sync them to the proper time, and with each other.
Thanks (3 Replies)
I use HP-UX & need help with time.
I use a script to create a date stamp: /bin/date "+%m%d%H%M" to get: 12080826.
I need a way to use the "touch -t" command to create a
file with a timstamp 30 minutes prior to that stamp. (12080756)
Can anyone help? (9 Replies)
Hi,
I want to synchronize time on several AIX servers - I don't want to set very precise time value, but I want all the servers to have same time value.
How do I do that ?
thanks
Vilius (2 Replies)
Hi guys,
I know that this topic has been discuss numerous times, and I have search the net and this forum for it.
However, non able to address the problem I faced so far.
I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
I need a command or mini scripts that can find certain type of images file recursively from the current dir with files of minimum 736 width and resize them by "736 max width, relative height" and replace the source files. I currently have GD installed but can also install Imagemagick if needed, I'm... (5 Replies)