Quantcast
Channel: Appending a current date from a variable to a filename - Unix & Linux Stack Exchange
Browsing all 6 articles
Browse latest View live

Answer by Atul Rokade for Appending a current date from a variable to a filename

You can rename file with time stamp appended to it mv TheFile.log TheFile.log.`date +"%d-%m-%Y"`

View Article



Answer by Eric Leschinski for Appending a current date from a variable to a...

Bash script to inject a date into a filename: This bash code in file called a.sh #!/bin/bash today=`date '+%Y_%m_%d__%H_%M_%S'`; filename="/home/el/myfile/$today.ponies" echo $filename; When run,...

View Article

Answer by Gilles for Appending a current date from a variable to a filename

You seem to have mixed up several things. set today = 'date +%Y' looks like tcsh syntax, but even in tcsh it assigns the string date +%Y to the variable today, it doesn't run the date command. As...

View Article

Answer by Arcege for Appending a current date from a variable to a filename

More than likely it is your use of set. That will assign 'today', '=' and the output of the date program to positional parameters (aka command-line arguments). You want to just use C shell (which you...

View Article

Answer by MelBurslan for Appending a current date from a variable to a filename

This: find . -name The_Logs -atime -1 -type d -exec mv {} "The_Logs_${today}" \; & should work. Although, it seems like you are using csh and my solution of removing the + sign may not work for you...

View Article


Appending a current date from a variable to a filename

I'm trying to append the current date to the end of a file name like this: TheFile.log.2012-02-11 Here is what I have so far: set today = 'date +%Y' mkdir -p The_Logs & find . -name The_Logs...

View Article
Browsing all 6 articles
Browse latest View live


Latest Images