Sponsored Content
Top Forums Shell Programming and Scripting AWK help print dirs with files in it Post 302553784 by jim mcnamara on Thursday 8th of September 2011 04:20:57 PM
Old 09-08-2011
I'm not sure what out you want or what your requirements are. Kinda vague.

This does what you seem to want
Code:
find /filetransfer/dir*/outgoing -mmin +10 |
while read fname
do
     echo "Please check file in outgoing directory: $(dirname $(dirname $fname)) "
done > sort -u

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

I need to ls all files in 4-6 deep dirs

I need to print to file , a listing of all files below a certain directory. Example: I need to print to file a listing of all files below the etc dir (including the subdirectories) with their full path. Any ideas on how to do this with one command. Or is this something I need to do on all... (4 Replies)
Discussion started by: gforty
4 Replies

2. UNIX for Dummies Questions & Answers

Forcing UID on Files/Dirs Created with SFTP?

I have a situation where I have to provide Windows based users with access to specific files and directories on a *nix web mail server. The users cannot use the CLI, so SSH is out. They've previously used a product called Webdrive to access *nix boxes via SFTP. The files and dirs they need... (5 Replies)
Discussion started by: deckard
5 Replies

3. Shell Programming and Scripting

script find files in two dirs HELP

I have a directory which is /home/mark/files/ , inside this particular I have a bunch of filles (see examples below) TST_SHU_00014460_20090302.txt TST_SHU_00016047_20090302.txt TST_SHU_00007838_20090303.txt TST_SHU_00056485_20090303.txt TST_SHU_00014460_20090303.txt... (2 Replies)
Discussion started by: fierusbentus
2 Replies

4. Shell Programming and Scripting

Find most recent files in dirs and tar them up?

Hey all.. This should be simple but stoopid here can't get head around it! I have many directories, say 100 each with many files inside. I need a script to traverse through the dirs, find most recent file in each dir and add it to a tar file. I can find the files with something like for... (1 Reply)
Discussion started by: bobdung
1 Replies

5. Shell Programming and Scripting

Have absolute path for files in different dirs

Hi everybody. I need a command to print the absolute path of files which name starts always with a pattern (MOD03), independently on where they are in the filesystem. I have tryedls -ld ${INPUTPREFIX}/*/*/* | grep MOD03 | awk '{ print $8 }'but I have to use "/*/*/*" in this case to have the... (5 Replies)
Discussion started by: canduc17
5 Replies

6. UNIX Desktop Questions & Answers

limit number of sub-dirs searched for files

using: find . -type f -print|xargs -li "string", how do I limit the dated directories (2010-7-14, 2010-7-13,etc.) to just 2009 & 2010 years of directories to search. We go back to 2004 in our archives, way too many files. (3 Replies)
Discussion started by: MJThom713
3 Replies

7. Shell Programming and Scripting

sort retrieved data files in different dirs

Hi, I have a script to retrieve data files from server and store them in a directory on local disk. The script runs everyday as cron job. But now those files are too many so my boss wants me to put the files into different directories base on dates. Those files look like this: ... (4 Replies)
Discussion started by: leafei
4 Replies

8. Debian

Problem with files/dirs deletion

Hi, The other day i installed a PHP based CMS (modx) on my shell account and noticed that i couldn't delete any of files/dirs it created after. Also, i noticed that all that stuff is owned by username-www instead of username. I tried chown, chmod and using a PHP script to do the same wti... (4 Replies)
Discussion started by: pentago
4 Replies

9. Shell Programming and Scripting

Moving files into dirs corresponding to dates

I am trying to find a way to move files into corresponding date files. i=0 while read line do array="$line" (( i++ )) done < <(ls) cd $(echo ${array}) echo ${array}} pwd #cd "$(array}" ] || mkdir 2015 cd "2015" ] || mkdir 02-February ] || mkdir 03-March ] || mkdir... (10 Replies)
Discussion started by: newbie2010
10 Replies

10. Shell Programming and Scripting

Replace a string in files in all dir and sub dirs

Hello, I need to replace xml version='1.1' with xml version='1.0' in all xml files under /app/jenkins/ in all dir and sub dirs in my CentOS VM, I tried below command but it didn't help, looks like I'm missing a character somewhere. grep -rl "xml version='1.1'" . | xargs sed -i 's/"xml... (2 Replies)
Discussion started by: mahesh Madpathi
2 Replies
scandir(3)						     Library Functions Manual							scandir(3)

Name
       scandir - scan a directory

Syntax
       #include <sys/types.h>
       #include <sys/dir.h>

       scandir(dirname, namelist, select, compar)
       char *dirname;
       struct direct *(*namelist[]);
       int (*select)();
       int (*compar)();

       alphasort(d1, d2)
       struct direct **d1, **d2;

Description
       The  subroutine	reads the directory dirname and builds an array of pointers to directory entries using It returns the number of entries in
       the array and a pointer to the array through namelist.

       The select parameter is a pointer to a user supplied subroutine which is called by to select which entries are to be included in the array.
       The  select routine is passed a pointer to a directory entry and should return a non-zero value if the directory entry is to be included in
       the array.  If select is null, then all the directory entries will be included.

       The compar parameter is a pointer to a user supplied subroutine which is passed to to sort the completed array.	If this pointer  is  null,
       the array is not sorted.  The is a routine which can be used for the compar parameter to sort the array alphabetically.

       The  memory  allocated  for  the array can be deallocated with free by freeing each pointer in the array and the array itself.  For further
       information, see

Diagnostics
       Returns -1 if the directory cannot be opened for reading or if cannot allocate enough memory to hold all the data structures.

See Also
       directory(3), malloc(3), qsort(3), dir(5)

																	scandir(3)
All times are GMT -4. The time now is 10:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy