Sponsored Content
Top Forums Shell Programming and Scripting Scan directories and create a list of files Post 302958419 by jiam912 on Thursday 22nd of October 2015 02:54:52 AM
Old 10-22-2015
Scan directories and create a list of files

Gents,

Please can you help.

I want to create a list which contends the complete patch of the location of some directories with the size of each file.

need to select only .txt file

In this case I am try to find the subdirectories tp1 and tp2 and create the output list.

Code:
jd175-1
	tp1
	1.txt
	2.txt
	tp2
	1.txt
	2.txt
jd176-1
	tp1
	3.txt
	4.txt
	tp2
	3.txt
	4.txt
jd177-1
	tp1
	5.txt
	6.txt
	tp2
	5.txt
	6.txt

output 2 files with the following results>

tp1
Code:
/jd175-1/tp1/1.txt/sizefile
/jd175-1/tp1/2.txt/sizefile
/jd176-1/tp1/3.txt/sizefile
/jd176-1/tp1/4.txt/sizefile
/jd177-1/tp1/5.txt/sizefile
/jd177-1/tp1/6.txt/sizefile

tp2
/jd175-1/tp2/1.txt/sizefile
/jd175-1/tp2/2.txt/sizefile
/jd176-1/tp2/3.txt/sizefile
/jd176-1/tp2/4.txt/sizefile
/jd177-1/tp2/5.txt/sizefile
/jd177-1/tp2/6.txt/sizefile

Thanks for your help
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Scan directory and sub directories

I am really stuck on a issue and have not been able to find a solution. With the code below I need to not only scan the current directory which as you can see below is... /lcl/sit/apps/Tivoli/ But I also want it to scan all sub directories it finds under Tivoli as well for the same thing... (2 Replies)
Discussion started by: LRoberts
2 Replies

2. UNIX for Dummies Questions & Answers

List directories and sub directories recursively excluding files

Hi, Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process. I wanted to disply using a unix command all the directories recursively excluding files. I tried 'ls -FR' but that display files as... (3 Replies)
Discussion started by: pointers
3 Replies

3. Shell Programming and Scripting

Create unique tar archives from a list of directories

I'm looking to archive a client directory from a CIFS share There are multiple directories that will be stored in a text file and I'm looking to create an individual tar archive of each folder in the directory. I've tried a number of commands to no avail. Here's what I would like. ... (2 Replies)
Discussion started by: Steelysteel
2 Replies

4. Shell Programming and Scripting

create more than 100 directories and copy files into them

Hi, I have several files containing experiment measurements per hour (hour_1.txt has measurements for first hour, etc..etc..). I have 720 of these files (i.e. up to hour_720.txt) and i want to create 720 directories and in every one of them i want to copy its associative file (e.g.... (4 Replies)
Discussion started by: amarn
4 Replies

5. UNIX for Dummies Questions & Answers

list directories with more than X files

I want to search a server beginning at /home and list directories with more than X files I found a hack that injects tons of files into a directory How can I search the server recursively and list directories with more than X files? Thank you! like, find /home (directories, that meet the... (5 Replies)
Discussion started by: vanessafan99
5 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. Shell Programming and Scripting

Copy of "How to create a long list of directories with mkdir?"

To bakunin and corona688: My result when text in file is ms_ww_546 ms_rrL_99999 ms_nnn_67_756675 is https://www.unix.com/C:\Users\Fejoz\Desktop\ttt.jpg I hope you can see the picture. There is like a "whitespace character" after 2 of the 3 created directories. ---------- Post... (0 Replies)
Discussion started by: setub
0 Replies

8. Shell Programming and Scripting

How to create a long list of directories with mkdir?

Hi... Thanks to read this... I want to use mkdir to create many directories listed in a text file, let's say. How do I do this? Sorry for this maybe very basic question :) (13 Replies)
Discussion started by: setub
13 Replies

9. Shell Programming and Scripting

Alignment tool to join text files in 2 directories to create a parallel corpus

I have two directories called English and Hindi. Each directory contains the same number of files with the only difference being that in the case of the English Directory the tag is .english and in the Hindi one the tag is .Hindi The file may contain either a single text or more than one text... (7 Replies)
Discussion started by: gimley
7 Replies
DIRDIFF(1)						      General Commands Manual							DIRDIFF(1)

NAME
dirdiff - display differences and merge changes between directory trees SYNOPSIS
dirdiff [-a|--all] [-o|--only pattern] [-I|--ignore pattern] [-r|--rcs] [-t|--bktag] [-c|--context num] [-b] [-w] [-B] [-i] [-d] [-S] [-k] dir1 dir2 ... OPTIONS
-a,--all Don't exclude any files. -o,--only pattern Only process files matching pattern. -I,--ignore pattern Don't process files matching pattern. -r,--rcs Ignore differences in RCS strings. -t,--bktag Ignore differences in Bitkeeper strings. -c,--context num Set number of lines of context to show. -b,-w,-B,-i,-d Pass these on to diff. -S Show files that are the same in the file list. -K Enable bitkeeper support. DESCRIPTION
Dirdiff is a graphical tool for displaying the differences between directory trees (up to 5) and for merging changes from one tree into another. At startup, dirdiff displays a main window with a list of the files that are different between the trees. Colored squares are used to indicate the relative ages of the versions. Files are like leaves on a deciduous tree: the newest ones are green, and then they turn yel- low, orange, and red as they get older. Missing files are black, and directories are white. To see the differences between two versions of a file, double-click on the file name. By default, the first and last versions are com- pared, but this can be changed using the Diff menu in the main window. In the differences window, there are checkboxes to the left of all the sections which are different. You can use button 1 to select an individual checkbox, or shift-button 1 or button 3 to select a whole group. Selecting a line means that you are asking for that change to be made when you update either of the files using the Merge menu. The line will be removed if it is already present or added if it is not present. To copy from one tree to another, click on the file name and select the appropriate copy operation from the Copy menu of the main window. Selecting Make patch from the File menu of the main window produces a file describing the changes between the files that can be applied by the patch tool. You can edit the patch before saving, and may wish to add explanatory text, instructions, or patch Prereq lines at the beginning. To save the patch, enter a filename in the patch window relative to the current directory, and choose Save. This will also close the window. If you are sending out patches, then the from directory should be the original version of the source. Try to make sure that the two files have the same number of leading directories. See the patch(1) man page for more information. NOTES
Dirdiff needs to be able to load the libfilecmp.so.0.0 shared library for the -r or -t flags to work. SEE ALSO
diff(1) patch(1) AUTHOR
Paul Mackerras May 2002 DIRDIFF(1)
All times are GMT -4. The time now is 08:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy