Sponsored Content
Top Forums Shell Programming and Scripting Loop folders, delete files, copy new ones Post 302488719 by acraig on Tuesday 18th of January 2011 09:09:40 AM
Old 01-18-2011
[Solved] 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/[user]/sansa" directory to each of the "/media" subfolders.

I have configured a Linux system as a charging station for about 50 Sansa Clip MP3 players with USB connectivity, which are being used for visitors to a museum attraction. Sometimes, visitors delete files from the players, or use the Sansa's recording feature to record sound files that other visitors need not access. The goal is to wipe the contents of the devices on a nightly basis, and retrieve them the next morning with freshly-written data.

Thanks for any assistance,
- Adam

Last edited by acraig; 01-18-2011 at 12:10 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

delete all folders/files and keep only the last 10 in a folder

Hi, I want to write a script that deletes all folders and keep the last 10 recent folders. I know the following: ls -ltr will sort the folders from old to recent. ls -ltr | awk '{print $9}' will list the folder names (with a blank line at the beginning) I want to get the 10th folder from... (3 Replies)
Discussion started by: melanie_pfefer
3 Replies

2. Shell Programming and Scripting

Unzip, copy, and delete loop

Hey there, I am trying to move zipped text files from a remote server to a remote tape storage facility, through my home directory. What I want to do is get the zip file (using scp), unzip it, copy the output text file which was inside (using rfcp) to the tape storage server, and then delete... (3 Replies)
Discussion started by: spyne
3 Replies

3. UNIX for Dummies Questions & Answers

copy all files and folders and cjange or remove ownership

So tried: cp -r -p test1/ user@machine:///srv/www/vhosts/domain.co.uk/httpdocs/backup/ but this didn't work either :( Anyone able to help with this? Many thanks Mr M (3 Replies)
Discussion started by: misterm
3 Replies

4. Shell Programming and Scripting

copy some files from users home folders to my folder

i have users home directories in /home all the users have some files starting with character e and i want to copy all these files in a folder in my (root) home using a script i tried the script for i in m5 do cd m5 cp e1* /home/pc/exam cd .. done but get these... (3 Replies)
Discussion started by: pcrana
3 Replies

5. UNIX for Dummies Questions & Answers

Delete folders and files in it - UNIX

I need to delete a folder and files in it of yesterdays and simply put this in cron. Folder name - "2010-03-2010" File name - "eprod_06_23.dmp" and "eprod_06_23.exp" Actually this folder and file is been created by a script which takes a backup of DB everyday.Thats why it creates folder and file... (3 Replies)
Discussion started by: j_panky
3 Replies

6. Shell Programming and Scripting

I need script Copy permissions of files and folders from one server to another

Hi.. I have 2 servers with linux suse10. I made a mistake and on one of the servers changed with chmod the permission of root in directory /. In the other servers the permissions are correct Please i need a script, to change the permissions of one server 1, using the same permission of the... (11 Replies)
Discussion started by: ave-phoenix
11 Replies

7. Windows & DOS: Issues & Discussions

Windows mass copy files with same name in differnt folders

I have files existing with same names in the folders with date as display below c:\2010-09-10 <==== folder arr1.jpg arr2.jpg arr3.jpg arr4.jpg c:\2010-09-09 <==== folder arr1.jpg arr2.jpg c:\2010-09-08 <==== folder arr2.jpg arr3.jpg arr4.jpg ... (5 Replies)
Discussion started by: jville
5 Replies

8. UNIX for Dummies Questions & Answers

copy mutilple files to mutiple folders

Hi, I just started to learn shell progamming and just can't get my head around the following problem. I need to do the following: I have a folder which contains 100+ subfolders. Inside these subfolders there is one folder named 'Morph' and several jpg's. I need to copy all the files into... (4 Replies)
Discussion started by: M474746
4 Replies

9. HP-UX

Recursive copy of Folders with files

Dear All, I will appreciate any help received. Our system is running on hpux v1 My problem is as follows: We have many customer folders with name fd000100, fd000101 and so on e.g. (Testrun)(testsqa):/>ll /TESTrun/fd000100 total 48 drwxrwx--- 2 fq000100 test 96 Jun 27 2004... (17 Replies)
Discussion started by: mhbd
17 Replies

10. Shell Programming and Scripting

How to copy files/folders and show the files/folders?

Hi, So i know we use cp -r as a basic to copy folders/files. I would like this BUT i would like to show the output of the files being copied. With the amazing knowledge i have i have gone as far as this: 1) find source/* -exec cp -r {} target/ \; 2) for ObjectToBeCopied in `find... (6 Replies)
Discussion started by: Imre
6 Replies
JTB(1)							      General Commands Manual							    JTB(1)

NAME
jtb - syntax tree builder for JavaCC SYNOPSIS
jtb [options] inputfile DESCRIPTION
This manual page documents briefly the jtb command. JTB (Java Tree Builder) is a syntax tree builder and visitors generator to be used in front of JavaCC (Java Compiler Compiler). It takes a JavaCC grammar file as input (usually a ".jtb" file) and automatically generates the following: - a set of syntax tree classes based on the productions in the grammar, utilizing the Visitor design pattern; - four interfaces: IVoidVisitor, IVoidArguVisitor, IRetVisitor, IRetArguVisitor; - four depth-first visitors: DepthFirstVoidVisitor, DepthFirstVoidArguVisitor, DepthFirstRetVisitor, DepthFirstREtArguVisitor, whose default methods simply visit the children of the current node; a JavaCC grammar ".jj" file (jtb.out.jj by default), with the proper annotations to build the syntax tree during parsing (which then must be compiled with JavaCC). New visitors, which subclass any generated one, can then override the default methods and perform various operations on and manipulate the generated syntax tree. OPTIONS
-cl Print a list of the classes generated to standard out. -d dir "-d dir" is short for (and overwrites) "-nd dir/syntaxtree -vd dir/visitor". -dl Generate depth level info. -e Suppress JTB semantic error checking. -f Use descriptive node class field names. -h Display this help message and quit. -ia Inline visitors accept methods on base classes. -jd Generate JavaDoc-friendly comments in the nodes and visitor. -nd NAME Use NAME as the package for the syntax tree nodes. -np NAME Use NAME as the package for the syntax tree nodes. -ns NAME Use NAME as the class which all node classes will extend. -o NAME Use NAME as the filename for the annotated output grammar. -p NAME "-p pkg" is short for (and overwrites) "-np pkg.syntaxtree -vp pkg.visitor". -pp Generate parent pointers in all node classes. -printer Generate a syntax tree dumping visitor. -si Read from standard input rather than a file. -scheme Generate Scheme records representing the grammar and a Scheme tree building visitor. -tk Generate special tokens into the tree. -vd NAME Use NAME as the package for the default visitor classes. -vp NAME Use NAME as the package for the default visitor classes. -w Do not overwrite existing files. SEE ALSO
javacc(1) AUTHOR
jtb was written by the UCLA Compilers Group. This manual page was written by David Paleino <dapal@debian.org>, for the Debian project (and may be used by others). This manual page was updated by Ludovico Cavedon <cavedon@debian.org>. Jun 2010 JTB(1)
All times are GMT -4. The time now is 02:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy