12-14-2008
Quote:
Originally Posted by
siba.s.nayak
The answer given by avi.skynet will perfectly work fpr all the files with .php through the file system. If you want to specify to your directory and subdirectory only then give the directory path instead of "/" in the find command.
For answering your question no 1, you need to set -depth = 1 to find command. So it will list the files only in main directory not in subdirectory.
can you explain more please with an example
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi,
I am newbie in UNIX so please excuse for my questions.
Is there a a way to search for string in files within folder and sub folder in particluar file extensions.
Ex. search for ABC in folder 'A'(including it's sub folders) in html, xml files.
Thanks,
Ani (2 Replies)
Discussion started by: anikanch
2 Replies
2. UNIX for Dummies Questions & Answers
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
3. Red Hat
Hi,
I want to write a command to remove all the files from a folder and inner child folder without removing the child folders of parent folder.
like I have folder like this...
folder a/b/c
file a/test.sql
file a/b/test2.txt
file a/b/c/temp.jpeg
now I want to remove all... (2 Replies)
Discussion started by: mkashif
2 Replies
4. Shell Programming and Scripting
Hi,
I want to write a command to remove all the files from a folder and inner child folder without removing the child folders of parent folder.
like I have folder like this...
Code:
folder a/b/c
file a/test.sql
file a/b/test2.txt
file a/b/c/temp.jpeg
now I want to remove... (5 Replies)
Discussion started by: mkashif
5 Replies
5. Shell Programming and Scripting
Hello!
I need to realize such task.
1. In my user's home dir I have folder1;
2. In folder1 I have some (various count) subfolders with random names;
3. In these subfolders I have one file anyname.pdf (various name in each subfolder) and file content.txt (constant name in each subfolder)
##... (7 Replies)
Discussion started by: optik77
7 Replies
6. Shell Programming and Scripting
Hi,
i am using the below script to zip the files with respect to their timestamp of the files.It is working fine.
For example lets take I have two files in this directory /path/folder1 with the timestamp as this month and previous month. When i run this script first time it is creating two... (7 Replies)
Discussion started by: velava
7 Replies
7. Shell Programming and Scripting
I need to write a script to :
list files with *.i extension in a directory and all its subdirectories + 30days old, save it in a file and then remove (2 Replies)
Discussion started by: lena keung
2 Replies
8. UNIX for Dummies Questions & Answers
Hi All,
I want to fetch the files based on .done file and display the .csv files and Wil take .csv files for processing.
1.I need to display the .done files from the directory.
2.next i need to search for the .Csv files based on .done file.then move .csv files for the one directory
... (2 Replies)
Discussion started by: girija.g6
2 Replies
9. Shell Programming and Scripting
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
10. UNIX for Beginners Questions & Answers
The bash below executes and does find all the .bam files in each R_2019 folder. However set -x shows that the .bam extension only gets removed from one .bam file in each folder (appears to be the last in each). Why is it not removing the extension from each (this is $SAMPLE)? Thank you :).
set... (4 Replies)
Discussion started by: cmccabe
4 Replies
LEARN ABOUT DEBIAN
ost_dirtree
ost::DirTree(3) Library Functions Manual ost::DirTree(3)
NAME
ost::DirTree -
A generic class to walk a hierarchical directory structure.
SYNOPSIS
#include <file.h>
Public Member Functions
DirTree (const char *prefix, unsigned maxdepth)
Construct a directory tree walk starting at the specified prefix.
DirTree (unsigned maxdepth)
Construct an un-opened directory tree of a known maximum depth.
virtual ~DirTree ()
void open (const char *prefix)
Open a directory tree path.
void close (void)
Close the directory path.
char * getPath (void)
Extract the next full pathname from the directory walk.
unsigned perform (const char *prefix)
This is used to step through the filter virtual for an entire subtree, and is used for cases where a derived DirTree class performs
it's primary operations through filter rather than externally by calling getPath().
Protected Member Functions
virtual bool filter (const char *file, struct stat *ino)
Virtual method to filter results.
Detailed Description
A generic class to walk a hierarchical directory structure.
Author:
David Sugar dyfet@ostel.com Directory tree walking.
Constructor & Destructor Documentation
ost::DirTree::DirTree (const char *prefix, unsignedmaxdepth)
Construct a directory tree walk starting at the specified prefix. A maximum subdirectory depth is also specified.
@param prefix to start walk.
@param maxdepth subdirectory depth to examine.
ost::DirTree::DirTree (unsignedmaxdepth)
Construct an un-opened directory tree of a known maximum depth. Parameters:
maxdepth subdirectory subdirectory depth.
virtual ost::DirTree::~DirTree () [virtual]
Member Function Documentation
void ost::DirTree::close (void)
Close the directory path.
virtual bool ost::DirTree::filter (const char *file, struct stat *ino) [protected], [virtual]
Virtual method to filter results. Virtual override methods should call baseclass method to assure . and .. names are stripped out.
Returns:
true if current filename is accepted.
Parameters:
file path to examine
ino info of type, date, etc.
char* ost::DirTree::getPath (void)
Extract the next full pathname from the directory walk. When returning directories, a '/' is appended. The returned string is a buffer of
MAX_PATH size.
Returns:
path of next subdirectory entry or NULL.
void ost::DirTree::open (const char *prefix)
Open a directory tree path. Parameters:
prefix directory path to open.
unsigned ost::DirTree::perform (const char *prefix)
This is used to step through the filter virtual for an entire subtree, and is used for cases where a derived DirTree class performs it's
primary operations through filter rather than externally by calling getPath(). Returns:
number of files and directories examined.
Parameters:
prefix directory path to examine.
Author
Generated automatically by Doxygen for GNU CommonC++ from the source code.
GNU CommonC++ Sat Jun 23 2012 ost::DirTree(3)