Sponsored Content
Top Forums Shell Programming and Scripting Loop through files in a directory Post 76002 by vino on Friday 24th of June 2005 01:37:25 AM
Old 06-24-2005
Why not run the process in the background ?

rladda.sh

Code:
#! /bin/sh

while true
do
for file in `ls /path/to/dir`
do
[[ -f $file ]] && echo "$file exists"
done
sleep 60
done

Check the /path/to/dir for any file every 60 seconds.

Run the script as

/path/to/rladda.sh &

Vino
This User Gave Thanks to vino For This Post:
 

10 More Discussions You Might Find Interesting

1. AIX

loop through the directory for files and sort by date and process the first file

hello i have a requirement where i have a direcotry in which i get files in the format STOCKS.20080114.dat STOCKS.20080115.dat STOCKS.20080117.dat STOCKS.20080118.dat i need to loop through the directory and sort by create date descending order and i need to process the first file. ... (1 Reply)
Discussion started by: dsdev_123
1 Replies

2. Shell Programming and Scripting

Loop certain code to all files within directory

Hi all, Can somebody help me with this problem pls. I need to extract one specific line from each files in a folder and put the all lines extracted in a unique output file in the following format. line extracted, respective name of file, date of file. I´m, trying the part to extract... (3 Replies)
Discussion started by: cgkmal
3 Replies

3. Shell Programming and Scripting

loop through files in directory

hi all i have some files present in a directory i want to loop through all the files in the directory each time i loop i should change the in_file parameter in the control file and load it into a table using sql loader there is only one table where i have to load alll the files ... (3 Replies)
Discussion started by: rajesh_tns
3 Replies

4. Shell Programming and Scripting

Find the latest directory and loop through the files and pick the error messages

Hi, I am new to unix and shell scripting,can anybody help me in sctipting a requirement. my requirement is to get the latest directory the name of the directory will be like CSB.monthdate_time stamp like CSB.Sep29_11:16 and CSB.Oct01_16:21. i need to pick the latest directory. in the... (15 Replies)
Discussion started by: sudhir_83k
15 Replies

5. UNIX Desktop Questions & Answers

Copy all files in 1 directory to another usinge for-in loop

I was looking to get some help with copying files in one directory to another using a for-in loop. My script file is called copyfile and here is what I have: for file in $(ls -a $1) do cp $file ~/dir-2 done When I run copyfile dir-1 this is what I get cp: omitting directory `.'... (1 Reply)
Discussion started by: Trinimini
1 Replies

6. UNIX for Dummies Questions & Answers

[Solved] Writing a loop to changing the names of files in a directory

Hi, I would like to write a loop to change the names of files in a directory. The files are called data1.txt through data1000.txt. I'd like to change their names to a1.txt through a1000.txt. How do I go about doing that? Thanks! (2 Replies)
Discussion started by: evelibertine
2 Replies

7. Shell Programming and Scripting

Loop through files in a directory

Hello How do I loop through files in a specific directory ? This script is not working! #! /bin/bash FILES=/usr/desktop/input/* For f in $FILES; do awk '-v A="$a" -v B="$b" {$6=($1-64)/2 ;$7=((10^($6/10))/A)^(1/B) ; print}' OFS="\t" $f > /root/Desktop/output/$f.txt; done ... (7 Replies)
Discussion started by: ali.seifaddini
7 Replies

8. Shell Programming and Scripting

Loop through files in directory

I am trying to loop through files in a directory, and sort each file. No matter what changes I make to the code, I get the following errors: 'aunch.sh: line 4: syntax error near unexpected token `do 'aunch.sh: line 4: `for f in ${FILES}/*; do #!/bin/bash FILES=$(pwd) for f in ${FILES}/*;... (1 Reply)
Discussion started by: ldorsey
1 Replies

9. Shell Programming and Scripting

Loop through files in directory

I am trying to loop through files in a directory, and sort each file. No matter what changes I make to the code, I get the following errors: 'aunch.sh: line 4: syntax error near unexpected token `do 'aunch.sh: line 4: `for f in ${FILES}/*; do #!/bin/bash FILES=$(pwd) for f in ${FILES}/*;... (6 Replies)
Discussion started by: ldorsey
6 Replies

10. Shell Programming and Scripting

How to exclude some files from the loop on the directory?

I have one question. On the directory I have many files start with DB.DAILYxxxxxxx.YYYYMMDD.HHMMSS and I have several files with other format, like LET.20170310 daily.20170310 tba.20170310 How can I exclude from my loop DB.DAILY files? I tried ls *20170310* | while read... (4 Replies)
Discussion started by: digioleg54
4 Replies
CPANPLUS::Internals::Utils(3pm) 			 Perl Programmers Reference Guide			   CPANPLUS::Internals::Utils(3pm)

NAME
CPANPLUS::Internals::Utils - convenience functions for CPANPLUS SYNOPSIS
my $bool = $cb->_mkdir( dir => 'blah' ); my $bool = $cb->_chdir( dir => 'blah' ); my $bool = $cb->_rmdir( dir => 'blah' ); my $bool = $cb->_move( from => '/some/file', to => '/other/file' ); my $bool = $cb->_move( from => '/some/dir', to => '/other/dir' ); my $cont = $cb->_get_file_contents( file => '/path/to/file' ); my $version = $cb->_perl_version( perl => $^X ); DESCRIPTION
"CPANPLUS::Internals::Utils" holds a few convenience functions for CPANPLUS libraries. METHODS
$cb->_mkdir( dir => '/some/dir' ) "_mkdir" creates a full path to a directory. Returns true on success, false on failure. $cb->_chdir( dir => '/some/dir' ) "_chdir" changes directory to a dir. Returns true on success, false on failure. $cb->_rmdir( dir => '/some/dir' ); Removes a directory completely, even if it is non-empty. Returns true on success, false on failure. $cb->_perl_version ( perl => 'some/perl/binary' ); "_perl_version" returns the version of a certain perl binary. It does this by actually running a command. Returns the perl version on success and false on failure. $cb->_version_to_number( version => $version ); Returns a proper module version, or '0.0' if none was available. $cb->_whoami Returns the name of the subroutine you're currently in. _get_file_contents( file => $file ); Returns the contents of a file $cb->_move( from => $file|$dir, to => $target ); Moves a file or directory to the target. Returns true on success, false on failure. $cb->_copy( from => $file|$dir, to => $target ); Moves a file or directory to the target. Returns true on success, false on failure. $cb->_mode_plus_w( file => '/path/to/file' ); Sets the +w bit for the file. Returns true on success, false on failure. $uri = $cb->_host_to_uri( scheme => SCHEME, host => HOST, path => PATH ); Turns a CPANPLUS::Config style "host" entry into an URI string. Returns the uri on success, and false on failure $cb->_vcmp( VERSION, VERSION ); Normalizes the versions passed and does a '<=>' on them, returning the result. $cb->_home_dir Returns the user's homedir, or "cwd" if it could not be found $path = $cb->_safe_path( path => $path ); Returns a path that's safe to us on Win32 and VMS. Only cleans up the path on Win32 if the path exists. On VMS, it encodes dots to _ using "VMS::Filespec::vmsify" ($pkg, $version, $ext) = $cb->_split_package_string( package => PACKAGE_STRING ); Splits the name of a CPAN package string up into its package, version and extension parts. For example, "Foo-Bar-1.2.tar.gz" would return the following parts: Package: Foo-Bar Version: 1.2 Extension: tar.gz perl v5.18.2 2014-01-06 CPANPLUS::Internals::Utils(3pm)
All times are GMT -4. The time now is 02:28 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy