Re: Bash Scripting Assistance

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



cd /path/where/you/want/to/create/the/new/dir
newdir=$(date '+%Y%m%d%H%M%S') 
mkdir $newdir
cp -a /path/where/your/old/files/are/* $newdir

maybe the one-liner could work

cp -a /path/holding/old/files/ /path/to/new/location/$(date '+%Y%m%d%H%M%S')

a "true" timestamp would be given with $(date '+%s')

hth



A 09:41 17/11/2003 -0700, vous avez écrit :
>Hello All,
>
>I wish to create a script that will copy the contents of a directory to
>another location. Not a big deal at all, however, prior to copying the
>data, I want to the script to mkdir a directory for the new data and I
>want the directory name to be the date and time stamp of the time the copy
>happened. I wish to use this script in a cron job.
>
>How would I go about creating a folder using the current time and date?
>
>Thanks much for the assistance
>
>Joe
>
>
>-- 
>redhat-list mailing list
>unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
>https://www.redhat.com/mailman/listinfo/redhat-list
>
>


-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux