Help! With File Moving


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Help! With File Moving
# 1  
Old 02-04-2015
Help! With File Moving

Hello,
This is my first post, so please forgive my obvious lack of UNIX knowledge. I am trying/needing to write a script that follows this functional flow:

1. Access a config file that contains format:
Code:
<directory> <filetype> <daterange> 
<directory> <filetype> <daterange> 
<directory> <filetype> <daterange> 
...

... per row, with no limit on the number of rows.

2. Copy these files meeting this criteria to a temp folder and zip them, using the current date/time as the zip file name.

This executable needs to be run daily at midnight (via crontab)?

Thank you for helping me solve this!

Last edited by rbatte1; 02-05-2015 at 10:03 AM..
# 2  
Old 02-05-2015
Welcome WildBeard83,

The best way to achieve your desired results is always to break them down into smaller and smaller steps. Consider doing it manually and try to work out what tasks you need to do and then break each one down further.

Most languages end up with a very few basic concepts:-
  • Execute in sequence
  • Execute in a loop
  • Execute depending on a condition
If you can refine your logic then it makes it easier to eventually write the code but computers are very obedient. They do exactly what you tell them, even if that's not what you quite meant.

Running at midnight would mean scheduling with cron would be well worthwhile.

So, to clarify your requirements:-
  • Do you need to:-
    • zip/compress each file individually
    • zip/compress all the files for today into a single archive
  • How will you match files based on the <daterange>
Sorry that there is no easy answer just yet, but if we can be certain of your needs, then I'm sure we can help you build something.


Regards,
Robin

Last edited by rbatte1; 02-05-2015 at 10:19 AM.. Reason: Welcome
# 3  
Old 02-05-2015
Please do not post the same question twice

Closing this thread, as the other seems to contain more discussion.
Complex File Move
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Moving a file from one location to another.

Hi, I've done a set of operations on some text files using a someexecutuble.jar file, which is internally calling some python scripts. Post that, in same location, my jar created some log files. However, i'm not able to re-direct the log files to some other location in my windows directory.... (1 Reply)
Discussion started by: arjun_arippa
1 Replies

2. UNIX for Dummies Questions & Answers

Validation before moving the File

Hi, Before moving the files from source directory to target directory I need to check if the files have these strings 'Error', 'Not Valid' ,' YTF-' or if the file is a zero byte file, if the file contains these strings or if it is a zero byte file i should log a entry in the log file and fail... (5 Replies)
Discussion started by: gaur.deepti
5 Replies

3. UNIX for Advanced & Expert Users

Need help on moving .csv file from UNIX to windows file path

Need help on moving .csv file from unix to windows file path. (1 Reply)
Discussion started by: lakshmanraok117
1 Replies

4. UNIX for Dummies Questions & Answers

Data file moving

Suppose there is a file “Text1.txt” which contains 100 lines. I need to move 1st 25 line into another file “Text2.txt” How we can do it? Suppose there is a file “Text1.txt” in which city: Bangalore is repeating N times. I need to replace Bangalore with Delhi. How we can do... (1 Reply)
Discussion started by: Rajesh1412
1 Replies

5. Shell Programming and Scripting

moving file

Hello ALL, i hope everyone is fine here. I have found some directories that have 777 permission with below command. find ./ -type d -perm 0777 e/uploads/ e/uploads/s1 j/uploads/ j/uploads/s1 I want that if there is any php|html|css file found in above directory so move those... (4 Replies)
Discussion started by: learnbash
4 Replies

6. Shell Programming and Scripting

Need help in finding filesize , moving file , gzipping file

Hi , Please help with the following questions 1) how can i find size of a file ? i have written du -k $flname > s1 . Is this right ? Any other better suggeastions ? 2) how do I use mv command for moving the file ? I need the syntax with some examples 3) Command for printing the total... (1 Reply)
Discussion started by: Learning!
1 Replies

7. UNIX for Dummies Questions & Answers

moving file from one folder to another

i have created file in one of the folders on unix UNIX 's36tou -T XYZ /tmp/p400/dataout/ias/AB >/dev/null I am using above command to copy file from one system to unix XYZ is name of file on my system usually this name is very big so i use -T to trim some charaters from name. noe... (1 Reply)
Discussion started by: ajit.yadav83
1 Replies

8. Shell Programming and Scripting

Finding & Moving Oldest File by Parsing/Sorting Date Info in File Names

I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves. Also, the script should only move a file from /exports to... (6 Replies)
Discussion started by: nikosey
6 Replies

9. UNIX for Dummies Questions & Answers

moving a file?

i'm trying to move a file from one diectory to another and rename it at the same time. but its giving me an error . " mv: cannot unlink /dir2/file5 : No such file or directory" here is the command I'm using. mv /dir1/file1 /dir2/file5 solaris 8 (1 Reply)
Discussion started by: Holistic
1 Replies

10. UNIX for Dummies Questions & Answers

moving or removing a file

Hi, Happy 2002. Now I am actually encountering a problem. Suppose I have a file which I can see has been named as -rw-rwx or .rwxrw-- . when I try to move this file I am unable to do so. Can someone please help me , How can i get rid of the file. Thanks in advance . :confused: (3 Replies)
Discussion started by: rooh
3 Replies
Login or Register to Ask a Question