Bash issue please help!
So my boss wants me to design a script (I just started working with bash scripting) to move all files with a set string to another directory, and have it echo out "these files have been moved". The first part of the script is working perfect as designed. The problem is he wants a display set to show which files are moved. I thought simple mv -v, that however is not working, the mv part is but its not displaying verbose.
I am now trying to find a way to do in if statement like modify date=$1 (1 is current date) any way to call upon the modification date through bash to complete this? I apologize for the length of this. |
sounds like a homework problem. cant help you with homework, but if this is not, first post what you have created and post the display output along with a sample desired output. please use code flags: [ code ] [ / code ] just remove the spaces and copy/paste.
also look into tee -a and >> also create a log file that you can pair >> with. Code:
echo "moving ${f} now " >> tee -a ${LOG} |
In some ways, this would be a better target for Perl. It has direct methods of getting file status, displays, and even creating windows (if thats what you need). Or maybe Python.
One command that lists the full information about a file is the "stat" command. You can then use awk to pull out the dates of the appropriate field. |
This is not homework and my boss told me i can use all the resources I need to accomplish this, I have never taken a class on bash and the class i did go through for unix/linux was for a military system.
in regards to the awk command, I am not wanting a file report. Is it possible to do something such as: list=$1 (for i in 'awk {print $6 $7 $9};) as a variable and then do. for i in 'll /some/random/file/'; do echo $1; done Please forgive me if this is horribly wrong. Like I said, this is the first bit of scripting I have ever done and im teaching myself as I go. ---------- Post added 12-20-13 at 04:50 PM ---------- And that was not suppose to be a smiley face btw |
Quote:
As also requested, show the code that you have working along with the part that is not and we will attempt to help ;) |
So:
Code:
[noparse];)[/noparse] |
All times are GMT -5. The time now is 10:44 PM. |