Sponsored Content
Top Forums Shell Programming and Scripting script to loop around folders Post 302095837 by aigles on Friday 10th of November 2006 01:37:25 PM
Old 11-10-2006
Something like that ?
Code:
homedata=/path/to/homedata
destinationdata=/path/to/destinationdata

cd ${homedata}
find . -type f | \
while read file
do
   destdir=${destinationdata}/`dirname ${file}`
   destfile=`basename ${file}`_OK
   [ ! -d ${destdir} ] && mkdir ${destdir}
   cp ${file} ${destdir}/${destfile}
done


Jean-Pierre.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help modifying script to loop through all folders

I have this script someone very kindly help me write last year which loops through all files in a folder and does a command. I need to modify it to loop through all sub-folders of a main folder and only perform the command on files modified after Jan 1st 2008. And I need the command to place the... (3 Replies)
Discussion started by: Fred Goldman
3 Replies

2. Ubuntu

Moving folders with script

Hi All, I am new to Forums, as i am struggling for one script i am launched here. I need to move more than 60,000+ folders in 1,00,000 folders to another server. I have the list of folders which should be moved. can anybody help me in sharing with the script for the above requirement. ... (4 Replies)
Discussion started by: ghimakiran
4 Replies

3. Shell Programming and Scripting

Loop through folders and open them

Well the title says it all. I need a loop script that directs to a folder and opens a bash file. I just found out about loop files the other day and yeah, dont know if that can be done. (6 Replies)
Discussion started by: snoopy817
6 Replies

4. Shell Programming and Scripting

Loop folders, delete files, copy new ones

Folks, I am hopeful that you may be able to help me out with writing a script that can be run nightly (as cron?) to loop through all subfolders within the "/media" directory, delete all of the files in each of them, and then copy in all of the files from the "/home//sansa" directory to each of... (6 Replies)
Discussion started by: acraig
6 Replies

5. Shell Programming and Scripting

Some manipulations with files and folders. (loop, find, create and remove)

Hello! I need to realize such task. 1. In my user's home dir I have folder1; 2. In folder1 I have some (various count) subfolders with random names; 3. In these subfolders I have one file anyname.pdf (various name in each subfolder) and file content.txt (constant name in each subfolder) ##... (7 Replies)
Discussion started by: optik77
7 Replies

6. UNIX for Dummies Questions & Answers

Searching for folders/parent folders not files.

Hello again, A little while back I got help with creating a command to search all directories and sub directories for files from daystart of day x. I'm wondering if there is a command that I've overlooked that may be able to search for / write folder names to an output file which ideally... (2 Replies)
Discussion started by: Aussiemick
2 Replies

7. UNIX for Beginners Questions & Answers

How to loop command over folders in a directory?

Hello all, I'm fairly new to scripting so please bear with me. I will try to explain as best as I can but if there's anything that is not clear, please let me know. I have a directory (see below) with numerous folders and within each of those folders are various files. I would like to run a... (11 Replies)
Discussion started by: azurite
11 Replies

8. Shell Programming and Scripting

Bash directory loop, but only choose those folders with specific word in it

Hello, how in bash i can get directory loop, but only choose those folders with specific word in it, so it will only echo those with specific word #!/bin/bash for filename in /home/test/* do if ; then echo $filename; fithx! (4 Replies)
Discussion started by: ZerO13
4 Replies

9. UNIX for Beginners Questions & Answers

Loop through the folders and search for particular string in files

Hello, Opearting System Environment : HP Unix B.11.31 U I look for script to On specific folders list On specific filelist Search for given string For Example : r48_buildlib.txt contains wpr480.0_20161027 wpr480.0_20161114 wpr481.0_20161208 wpr482.0_20161222... (4 Replies)
Discussion started by: Siva SQL
4 Replies

10. Shell Programming and Scripting

Trying to loop through folders and execute an existing python script.

I am trying to loop through lots and lots of folders and use the names of the folders to run a Python script which has parameters. E.g. -- setup_refs -n John -f England/London/Hackney/John -c con/con.cnf Normally to run `setup_refs` once from command line it's: `python setup_refs.py -n John... (3 Replies)
Discussion started by: Mr_Keystrokes
3 Replies
FOOMATIC-KITLOAD(8)					      System Manager's Manual					       FOOMATIC-KITLOAD(8)

NAME
foomatic-kitload - installs a data kit into the foomatic database. SYNOPSIS
foomatic-kitload [ -k kit-dir] [ -d dest-dir]... DESCRIPTION
foomatic-kitload installs a foomatic data kit into the local data library. It takes a -k dirname option, where dirname is the toplevel directory of a foomatic driver "kit". A "kit" is a selection of XML source files arranged exactly as in the source/section of the master database (ie, opt/driver/printer/ subdirs). Gimp-Print's foomatic-generator produces exactly such a kit. Foomatic-kitload is moderately paranoid about kits: the kit must contain at least one of printer, driver or opt; the kit must contain only files ending in .xml, the kit cannot be the local library itself, etc. But it does not inspect the contents of the kit files in any way. Options -k dirname dirname is the toplevel directory of a foomatic driver "kit". -d destdir destdir is a prefix to prepend to the install path. This will not normally be required, but is useful if installing into a tem- porary `staging area' prior to installing in the final destination. EXIT STATUS
foomatic-kitload returns 0 on success, 255 or something else when an error occurs. AUTHOR
Manfred Wassmann <manolo@NCC-1701.B.Shuttle.de> for the foomatic project using output from the associated binary. BUGS
Please post bug reports on http://lists.freestandards.org/mailman/listinfo/printing-foomatic Foomatic Project 2001-05-07 FOOMATIC-KITLOAD(8)
All times are GMT -4. The time now is 02:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy