Sponsored Content
Top Forums UNIX for Advanced & Expert Users Extracting the different files from directory & its sub directories Post 302332005 by lathavim on Tuesday 7th of July 2009 11:13:18 PM
Old 07-08-2009
Would you like to have different output files for each extension?

Code:
 
find give_path_here  -type f >temp.lst
while read record
do
a=`echo $record | cut -d "." -f2`
echo $record >>outfile_$a
done<temp.lst

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

List files that are not directories from current directory

I can't manage to list all files that are not directories from current directory. (2 Replies)
Discussion started by: beni22sof
2 Replies

2. Shell Programming and Scripting

how many directories and files are there in a directory

I want to know how many directories and files are there in a directory and if the sub directory have any files i also need that also . I have done this far .... (4 Replies)
Discussion started by: smongam
4 Replies

3. Shell Programming and Scripting

mget * (obtein files from current directory but not the files form sub-directories)

Hello, Using the instruction mget (within ftp) and with "Interactive mode off", I want to get all files from directory (DirAA), but not the files in sub-directories. The files names don't follow any defined rule, so they can be just letters without (.) period Directory structure example: ... (0 Replies)
Discussion started by: Peter321
0 Replies

4. Shell Programming and Scripting

compare files in two directories and output changed files to third directory

I have searched about 30 threads, a load of Google pages and cannot find what I am looking for. I have some of the parts but not the whole. I cannot seem to get the puzzle fit together. I have three folders, two of which contain different versions of multiple files, dist/file1.php dist/file2.php... (4 Replies)
Discussion started by: bkeep
4 Replies

5. Shell Programming and Scripting

going through files in a directory, and it's sub-directories

i have a c-shell script. and i pass it one or two arguments the first argument is the directory the second is the "-r" now, if i pass it only one, it searches the files ending in txt in that directory if i pass it two parameters, like "temp" and "-r" i want it to go through all the files and... (1 Reply)
Discussion started by: pantelis
1 Replies

6. Shell Programming and Scripting

How to list all the files, directories and sub-directories in the current path except one directory?

Can anyone come up with a unix command that lists all the files, directories and sub-directories in the current directory except a folder called log.? Thank you in advance. (7 Replies)
Discussion started by: Manjunath B
7 Replies

7. UNIX for Advanced & Expert Users

Find all files in the current directory excluding hidden files and directories

Find all files in the current directory only excluding hidden directories and files. For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided. `find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Discussion started by: ksailesh1
7 Replies

8. Shell Programming and Scripting

One directory, extracting only files to a new directoy

I need a hint for extracting and copying only the loads of .mp3 files from one directory and its subdirectories to get them all into only one directory. This way I am doing gives me a identical copy with hundreds of subdirectories. But I just don't get it to extract only the files. Though I tried... (9 Replies)
Discussion started by: 1in10
9 Replies

9. AIX

How to backup a directory (sub-directories/files) files from one server on to other ?

Hello, Server A: /directory1/ Server B: /Backups/ i wanted to backup contents of /directory1 from "server A" on to "Server B" every 1 hour. If there is any change in (only new/differences) contents on serverA (directory1/) supposed to be backeup on next run. I did used rsync command to... (5 Replies)
Discussion started by: System Admin 77
5 Replies

10. Shell Programming and Scripting

Compressing & removing files in a directory & subdirectory

Hi, I want a simple line of code that will compress files within a directory specified (parameter) and its subdirectories and also i want to remove files which are exactly 365 days old from the sysdate after this compression. Please help. Thanks, JD (8 Replies)
Discussion started by: Jesshelle David
8 Replies
BACKUP(8)						      System Manager's Manual							 BACKUP(8)

NAME
backup - backup files SYNOPSIS
backup [-djmnorstvz] dir1 dir2 OPTIONS
-d At top level, only directories are backed up -j Do not copy junk: *.Z, *.bak, a.out, core, etc -m If device full, prompt for new diskette -n Do not backup top-level directories -o Do not copy *.o files -r Restore files -s Do not copy *.s files -t Preserve creation times -v Verbose; list files being backed up -z Compress the files on the backup medium EXAMPLES
backup -mz . /f0 # Backup current directory compressed backup /bin /usr/bin # Backup bin from RAM disk to hard disk DESCRIPTION
Backup (recursively) backs up the contents of a given directory and its subdirectories to another part of the file system. It has two typ- ical uses. First, some portion of the file system can be backed up onto 1 or more diskettes. When a diskette fills up, the user is prompted for a new one. The backups are in the form of mountable file systems. Second, a directory on RAM disk can be backed up onto hard disk. If the target directory is empty, the entire source directory is copied there, optionally compressed to save space. If the target directory is an old backup, only those files in the target directory that are older than similar names in the source directory are replaced. Backup uses times for this purpose, like make. Calling Backup as Restore is equivalent to using the -r option; this replaces newer files in the target directory with older files from the source directory, uncompressing them if necessary. The target directory con- tents are thus returned to some previous state. SEE ALSO
tar(1). BACKUP(8)
All times are GMT -4. The time now is 01:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy