Sponsored Content
Top Forums UNIX for Advanced & Expert Users moving multiple files --recursively using BSD Post 82260 by moxxx68 on Tuesday 30th of August 2005 08:38:44 AM
Old 08-30-2005
Tools moving multiple files --recursively using BSD

i am using a FreeBSD remote account and I have directory that holds a number of
other directories most of which posses *.tgz *.tar.bz2 *.gz files... on a linux system
i would use a find format such as this to locate and mv *.tgz and *.tar.bz2 files
find ./dir -type f -iname "*.t[argz]*[bz2]" -print | xargs mv --target-directory=dir

on bsd this doesn't work since the mv options are slightly differenr than gnu linux..

i used "find ./dir -depth -print | cpio -ov > tree.cpio" and mv the file to a said dir and
extracted the filesystem but i could not find a way to extract just the files using find,
xargs or cpio on the BSD system... what I had to do was ftp the file to my linux system
do all operations and scp the whole directory of extracted files back to the account..
how would i go about extracting just the files using find and xargs or cpio on BSD
without having to go through the rigmarole of ftping back forth between my linux
system and the remote account...
thanx moxxx68 Smilie


excuse the grievance: i have a small typo that would make difference to anyone looking at
my post;;
find ./dir -type f -iname "*.t[arg]*[bz]2" -depth -print0 | cpio --null -pvd ./target-dir
without the print0 expression you might get a slightly different result.. unfortunately on some
bsd systems i am pretty sure that it doesn't exist ... i could be wrong though.. Smilie

Last edited by moxxx68; 09-12-2005 at 09:16 AM.. Reason: typo ...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

moving and renaming multiple files

Greetings, I know i can use the mv command to move and rename one file. How can I do this with multiple files? example pic01.bmp to pic0001.bmp how can i perform this function on an entire directory of sequential files and keep them in sequence? Hints, suggestions are most welcome:) ... (1 Reply)
Discussion started by: rocinante
1 Replies

2. Shell Programming and Scripting

Moving multiple files and renaming them on the fly

Hi All, Being new to scripting I am facing a new situation. We have an application that generates a file lets say dumpfile for each user under the users home directory when they execute the application. This is quite a huge file and imagine having that for over 40 users on a daily basis. The... (1 Reply)
Discussion started by: daemongk
1 Replies

3. Shell Programming and Scripting

using mv command for moving multiple files in a folder

Hi, I have a requirement where I need to move Bunch of folders containing multiple files to another archive location. i want to use mv command .I am thinking when we use mv command to move directory does it create directory 1st and then move all the files ? e.g source... (4 Replies)
Discussion started by: rkmbcbs
4 Replies

4. UNIX for Dummies Questions & Answers

Need help in moving files recursively

Hi, I have d1,d2,d3 directories / /home/abc/d1 /home/abc/d2 /home/abc/d3 d1,d2 and d3 also have subdirctories. d1-->d11-->d12 d2-->d22-->d23 d3-->d33-->d34 All these directories have files like date_filename.txt so I want to find the files recusively for a particular date from... (1 Reply)
Discussion started by: jagadish_gaddam
1 Replies

5. UNIX for Dummies Questions & Answers

Zip multiple files recursively via UNIX

Hello, After searching, I didn't find any answer to execute my task. Her what I want to achieve on my MAC : Create a ZIP file (not tar.gz or other) from a file I want the ZIP created to have the name of the original file I want to do this on multiple files (314 exactly) So at the end the... (3 Replies)
Discussion started by: anou
3 Replies

6. UNIX for Advanced & Expert Users

Moving multiple files based on the pattern

I want to search for a particular file name patterns and move them to a specific folder, is it possible to do it with awk or sed? (1 Reply)
Discussion started by: rudoraj
1 Replies

7. Shell Programming and Scripting

[SOLVED] moving multiple files? mv

HI I have a list of files that are incorrectely names and I need to move them to new name .. I tried few things that has not worked so far can you help ? I need to rename all thes eifle ( tere are over 100 ) xldn0357bap.orig.new xldn0389bap.orig.new xldn0439bap.orig.new... (12 Replies)
Discussion started by: mnassiri
12 Replies

8. Shell Programming and Scripting

Moving and renaming multiple files in a directory

Hi. I am trying to automate the movement and renaming of a number of files in a directory. I am using the 'mv' command as I do not have access to 'rename'. I have the following scripted FILES=$(ls /transfer/move/sys/mail/20130123/) if ; then for i in ${FILES} ; do mv... (4 Replies)
Discussion started by: jimbojames
4 Replies

9. UNIX for Dummies Questions & Answers

Moving multiple datestamped files (Linux)

Hello all, I'm writing a script that will allow me to move files into a sub-directory for archiving. These files, specifically, are output files that result at the end of a process. The issue I'm having is that while moving files from one place to another is relatively an easy task, grabbing... (2 Replies)
Discussion started by: galileo1
2 Replies

10. Shell Programming and Scripting

Search/Replace in multiple files recursively

Hi there, I am using AIX and trying to search and replace a string with another string in multiple files in different directories. I wanted to search replace in steps so I don't change all of the instance anywhere in the server at once, minimizing impact. STEP 1: -------- I first searched... (5 Replies)
Discussion started by: zaino22
5 Replies
backup(1M)																backup(1M)

NAME
backup - backup or archive file system SYNOPSIS
[-archive] DESCRIPTION
The command uses find(1) and cpio(1) to save a archive of all files that have been modified since the modification time of on the default tape drive should be invoked periodically to ensure adequate file backup. The option suppresses warning messages regarding optional access control list entries. backup(1M) does not backup optional access control list entries in a file's access control list (see acl(5)). Normally, a warning message is printed for each file having optional access control list entries. The option causes backup to save all files, regardless of their modification date, and then update using touch(1). prompts you to mount a new tape and continue if there is no more room on the current tape. Note that this prompting does not occur if you are running from cron(1M). The option causes to start a file system consistency check (without correction) after the backup is complete. For correct results, it is important that the system be effectively single-user while is running, especially if is allowed to automatically fix whatever inconsisten- cies it finds. does not ensure that the system is single-user. You can edit to customize it for your system. Several local values are used that can be customized: specifies which directories to back up recursively (usually meaning all directories); file name where start and finish times, block counts, and error messages are logged; file name whose date is the date of the last archive; file name that is checked by to remind the next person who logs in to change the backup tape; file name where start and finish times and output is logged. You may want to make other changes, such as whether or not does automatic correction (according to its arguments), where output is directed, other information logging, etc. In all cases, the output from is a normal archive file (or volume) which can be read using with the option. File Recovery creates archive tapes with all files and directories specified relative to the root directory. When recovering files from an archive tape created by you should be in the root directory and specify the directory path names for recovered files relative to the root directory When specifying the directory path name for file recovery by do not precede the leading directory name with a slash. If you prefer, you can also use with a option to determine how files and directories are named on the archive tape before attempting recovery. WARNINGS
Refer to in cpio(1). When runs out of tape, it sends an error to standard error and demands a new special file name from To continue, rewind the tape, mount the new tape, type the name of the new special file at the system console, and press If is being run unattended from cron(1M) and the tape runs out, terminates, leaving the process still waiting. Kill this process when you return. FILES
parameterized file names SEE ALSO
cpio(1), find(1), touch(1), cron(1M), fbackup(1M), frecover(1M), fsck(1M), acl(5). backup(1M)
All times are GMT -4. The time now is 01:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy