Sponsored Content
Top Forums Shell Programming and Scripting File in a folder and loop until time Post 302424585 by RubinPat on Tuesday 25th of May 2010 07:14:06 PM
Old 05-25-2010
File in a folder and loop until time

Hi All,

I am stuck with this requirement. My requirement is that a job will run daily at anytime before and would look for a file named filename.txt in a folder and mv to a different folder and if not found until 9 A.M it will exit with a success code.

Now I did the follwing ..but there is an issue I am having

Code:
wait time=1
current time=$(date +'%H%M')
max-time 5
 
run time =0
while:
do
cd mydir
if [[current time < '900']]
then if [-e filename.txt]
then mv folder1  folder2
exit 0;
fi
else
exit 0;
fi
 
if [run time -ge max time] then echo "time out"
exit 0;
fi
 
sleep 60
run time=run time + wait time
done

Now this code works except for one instance when the time passes 9 A.M and the filename.txt doesnot arrive...it keeps looping...i need it to exit..

My code above is a rough one...but mostly it....can you please tell me how to work it out or if there is any other way....

Moderator's Comments:
Mod Comment I have edited your post to add CODE-tags. Please use CODE-tags when posting code(-fragments), file contents or system output. It is easier to read that way and it helps our automated translation service by excluding parts marked this way from automatic translation. Thank you.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Parse the .txt file for folder name and FTP to the corrsponding folder.

Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)
Discussion started by: MeganP
3 Replies

2. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

This is the file structure: DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies

3. UNIX for Dummies Questions & Answers

How to append time to folder

Hi i just want to create a folder with current time. For example. foldername_09042010 How do i modify mkdir or write script to do this? (1 Reply)
Discussion started by: pinga123
1 Replies

4. Shell Programming and Scripting

Last modified time of the folder is changing when I view the file inside the directory

Hi., Last modified time of the folder is changing when I view the file inside the directory. Here is the test on sample directory. I believe that ls -l commands gives the time detail w.r.t last modified time. Pl. suggest. bash-3.2$ mkdir test bash-3.2$ cd test bash-3.2$ touch myfile.txt... (2 Replies)
Discussion started by: IND123
2 Replies

5. Shell Programming and Scripting

Loop through text file > Copy Folder > Edit XML files in bulk?

I have a text file which contains lines in this format - it contains 105 lines in total, but I'm just putting 4 here to keep it short: 58571,east_ppl_ppla_por 58788,east_pcy_hd_por 58704,east_pcy_ga_por 58697,east_pcy_pcybs_por It's called id_key.txt I have a sample folder called... (9 Replies)
Discussion started by: biscuitcreek
9 Replies

6. Shell Programming and Scripting

loop through files in each folder and perform sed

Dear all, I have few log folders in directory (FILE) and i need to perform sed on each files inside each folders. Here is my script, and i wish to rename each file back to the same file name after modification. Can anyone guide me on my script below? eg: folder1 contain files... (2 Replies)
Discussion started by: ymeyaw
2 Replies

7. Shell Programming and Scripting

For loop to read folder which are not under processing

Hi, I want to read folders which do not have a file "processing" in a for loop ordered by timestamp. Currently im doing like this. Like cd /home/working for i in `ls -c1` do some command... done I want to exclude folders which have that "processing" file. The directory... (2 Replies)
Discussion started by: chetan.c
2 Replies

8. Shell Programming and Scripting

For loop for number of files in a folder

Hi All, Need a for loop which should run for number of files in a folder and should pass the file name as parameter to another shell script for each loop. Please help me. Thanks. (2 Replies)
Discussion started by: chillblue
2 Replies

9. UNIX for Dummies Questions & Answers

Loop for file merging in a folder

Dear all, I have a few files in a folder (lets say 5) and each have a few lines in them. I want to create merges of each of them with the other ones e.g. I need the following merges I tried to write a loop and started with combinations of 2, I get the write file names but for each... (17 Replies)
Discussion started by: A-V
17 Replies

10. UNIX for Beginners Questions & Answers

Create new folder and text file the same time in one line

Is it possible to create new folder and write a new text file in the folder while the current position is outside the new folder? in one line mkdir folder | echo "hello test"> folder/test.txt not work. (1 Reply)
Discussion started by: cmdcmd
1 Replies
FL-RUN-BENCH(1) 						   Debian manual						   FL-RUN-BENCH(1)

NAME
fl-record - runs a funkload test SYNOPSIS
fl-record [ options ] file class.method DESCRIPTION
A funkload test can be turned into a load test, just by invoking the bench runner fl-run-bench. OPTIONS
--version show program's version number and exit --help, -h show this help message and exit --url=MAIN_URL, -uMAIN_URL Base URL to bench. --cycles=BENCH_CYCLES, -cBENCH_CYCLES Cycles to bench, this is a list of number of virtual concurrent users, to run a bench with 3 cycles with 5, 10 and 20 users use: -c 2:10:20 --duration=BENCH_DURATION, -DBENCH_DURATION Duration of a cycle in seconds. --sleep-time-min=BENCH_SLEEP_TIME_MIN, -mBENCH_SLEEP_TIME_MIN Minimum sleep time between request. --sleep-time-max=BENCH_SLEEP_TIME_MAX, -MBENCH_SLEEP_TIME_MAX Maximum sleep time between request. --startup-delay=BENCH_STARTUP_DELAY, -sBENCH_STARTUP_DELAY Startup delay between thread. --no-color Monochrome output. --accept-invalid-links Do not fail if css/image links are not reachable. --simple-fetch Don't load additional links like css or images when fetching an html page. --label=LABEL, -l LABEL Add a label to this bench run for easier identification (it will be appended to the directory name for reports generated from it). SEE ALSO
fl-build-report(1), fl-credential-ctl(1), fl-install-demo(1), fl-monitor-ctl(1), fl-record(1), fl-run-test(1). AUTHOR
Funkload was written by Benoit Delbosc. This manual page was written by Jose Parrella <bureado@debian.org>, for the Debian project (but may be used by others). Debian Project 26 March 2009 FL-RUN-BENCH(1)
All times are GMT -4. The time now is 11:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy