Operating on a directory and its subdirectories, recursively.
0
votes
2answers
109 views
Using `ls` recursively without -R
I am trying write a shell script that has output similar to ls -R without using the option -R.
This is part of a programming assignment that forbids me from using -R, find and du. I need to identify ...
5
votes
4answers
44 views
Copying specific subfolders with directory structure to a new folder
I am having a the following directory structure:
Main_Dir
|
-----------------------------------
Subdir1 Subdir2 Subdir3
| | ...
1
vote
2answers
43 views
How to exclude hidden files in recursive chmod?
I am having to do chmod -R 755 some_dir where 'some_dir' contains '.git' folders. Is there any way I can exclude hidden files and folder when doing recursive chmod?
Note: chmoding .git folder is ...
2
votes
1answer
57 views
Merging folders with practically the same name but different casing
When digging around in the advanced settings in Dropbox I lost a folder. I only discovered this about a month later. I managed to get this folder back from Dropbox however the file structure of the ...
4
votes
2answers
54 views
Recursively add a file to all sub-directories
How do I recursively add(or touch) a file into the current directory, as well as all sub-directories?
For example,
I would like to turn this directory tree:
.
├── 1
│ ├── A
│ └── B
├── 2
│ └── ...
3
votes
2answers
127 views
recursive delete with sftp?
I have a host that I can only access with sftp, scp, and rsync-- no ssh. I have a large tree of directories that I want to delete, but my sftp client apparently does not support recursive rms or ...
0
votes
1answer
41 views
Recursively Move All MP3's in a Directory [duplicate]
I have a lot of mp3 files located at various levels of subdirectories inside a single folder and I want to move them all to a single directory, what command could I use to do this?
Thanks!
1
vote
2answers
87 views
Removing specific files recursively using rm or something simple?
I have a root folder with a text file in it called pairs.txt.
Within that root folder are other folders with text files called pairs.txt in them.
Is there a simple way to remove them using rm?
I ...
2
votes
3answers
135 views
clone root directory tree using busybox
I have an TI DaVinci-based (ARM architecture kin to OMAP) system which netboots using TFTP and NFS-mounted root filesystem, and am trying to make it boot standalone without a netboot server.
The ...
3
votes
1answer
131 views
How to download all html files from a URL's directory with wget?
I'd like to use wget to download a tutorial in a website, but this tutorial is in a specific directory.
Suppose the URL is the tutorial main page http://www.abc.com/aaa/bbb/ccc/index.html.
But the ...
1
vote
3answers
217 views
Count number of lines with a certain value in a column for all files in directory recursively
I have 40 files in a directory and I want to count the number of times there is a line with a "2" in the first column in each file individually.
I am trying something like this, but it prints out ...
1
vote
2answers
147 views
How do I run a command on multiple files
This is pretty basic, I have a folder with several subfolders of JS files and i want to run Google's Clojure compiler on all of the files in those folders. The command to process a single file is as ...
1
vote
2answers
88 views
I quite like mercurial .hgignore-style globbing. Is there a Linux shell that supports it?
I quite like mercurial .hgignore-style pattern globbing.
Globs are rooted at the current directory; a glob such as *.c will only match files in the current directory ending with .c.
The ...
4
votes
4answers
224 views
chmod recursive permission on thousands of files
This is a more general question about 'chmoding' recursively.
I have this script which at some point needs to change the permissions recursively in a folder which has a few hundred thousand files.
...
4
votes
4answers
80 views
How to deal with spaces in a variable
I'm working on some scripting:
for x in `find ./ -name *.pdf`
do
echo pathname $x
done
My filenames are Test1 ( Volume II), Test2 ( Volume II).
I'm getting a return of
pathname Test1
pathname (
...
2
votes
2answers
180 views
How can I rename all files with one extension to a different extension recursively [duplicate]
Say I have a folder:
/
/a.bub
/v.bub
/dr.bub
/catpictures
/catpictures/or.bub
/catpictures/on.bub
How can I format a script to change each of these to .aaa.
Here is what I've got, although it ...
1
vote
1answer
38 views
Change some ASP code to PHP code in all files
I'm migrating a directory of files containing fairly simple ASP code over to a PHP server and I need to modify the contents of all the files with a find and replace mechanism. I'm not great with ...
2
votes
3answers
128 views
Help searching in files for regex patterns, recursively, with specialized output
My problem is that I need to:
Find all lines matching regex_pattern in all files (deep search) in a given root directory
For each line that matches, output:
File name
Line number containing the ...
5
votes
2answers
238 views
Excluding a specific directory using a recursive 'ls'
I've been using the following command to list the most recently updated files (recursively) within a specific directory and order by modification time:
$ stat --printf="%y %n\n" $(ls -tr $(find * ...
1
vote
3answers
166 views
How to rename pattern in one file to another over several directories recursively
I have several directories through which I want to recursively iterate over and change the file name of
*.GEOT14246.*
to
*.GEOT15000.*
Is there a one liner on the bash script to do this ...
1
vote
1answer
148 views
wget recursive with files without extension
I'm not very good with Linux so I have maybe a basic question. I've search around for the "how to" and I couldn't find anything.
I'm trying to get a site with wget. The problem is that it:
Have ...
2
votes
4answers
590 views
Find and copy directories containing file type
I have a directory "Movies" containing subdirectories "Movie Name". Each subdirectory "Movie Name" contains a movie file and related image/nfo files etc.
I'm trying to copy all directories containing ...
1
vote
2answers
91 views
Search and replace full line in recursive files
I'm using:
grep -n -H -o -R -e textword .
List all file recursively under directory '.' with string 'textword' and show the file, line and only portion matching.
I need to remove lines that ...
1
vote
2answers
107 views
Direct recursive shell script output to each subdirectory, not parent directory
I'm processing a batch of subjects data recursively, calling the script within the parent directory.
For example, I have the parent directory:
/home/subjects
and the subdirectories which contain ...
1
vote
2answers
374 views
Excluding a directory name in a zsh recursive glob
I'm running zsh on Linux under setopt extended_glob ksh_glob glob_dots. I'm looking for something easy to type on the command line, with no portability requirements. I'm looking at a source code tree, ...
0
votes
3answers
182 views
Find executable files recursively
I have got the directory called Test and a few directories inside it. Both Test and the directories inside it have executable files. I'd like to print them with ls. I'd use this command.
ls -l `find ...
4
votes
4answers
227 views
How to recursively find the amount stored in directory?
I know you are able to see the byte size of a file when you do a long listing with ll or ls -l. But I want to know how much storage is in a directory including the files within that directory and the ...
2
votes
4answers
2k views
Move all files with a certain extension from multiple subdirectories into one directory
Suppose I have a bunch of zip files in several directories:
Fol1/Fol2
Fol3
Fol4/Fol5
And I want to move them all to a common base folder. How would I do this?
2
votes
1answer
480 views
Makefile $wildcard only matches top directory
I am trying to implement a makefile for my C project which has a directory structure as follows:
PROJECT_FOLDER:
folder1
folder2
folder // n number of folders
main.c
FOLDER1:
...
3
votes
1answer
79 views
Passing all files of specific filetype in current and subdirectories
I have constructed an elaborate 500+ character command with many arguments and switches to autosign multiple PDF documents.
I'm using JSignPDF and I'd like to use it's batch mode including the ...
2
votes
3answers
562 views
Manipulate file name piped from find command
I'm relatively new to Bash and am trying to do something that on the surface seemed pretty straightforward - run find over a directory hierarchy to get all of the *.wma files, pipe that output to a ...
1
vote
2answers
122 views
find “an expression” on each file of a directory recursively
One of my website on my webserver has suffered an attack : code injection.
Here is the malicious code :
<script type=\"text/javascript\" language=\"javascript\">
(function () {
var t ...
0
votes
2answers
436 views
Sed find/delete for a string with multiple special characters recursively
I'm having quite a bit of difficulty with a complex string. A friend's site was hacked and has since been locked down but I'm helping to clean up the mess leftover and what I need to do is the ...
3
votes
2answers
1k views
wget - How to download recursively and only specific mime-types/extensions (i.e. text only)
How to download a full website, but ignoring all binary files.
wget has this functionality using the -r flag but it downloads everything and some websites are just too much for a low-resources ...
10
votes
3answers
1k views
Flattening a nested directory
This is probably very simple, but I can't figure it out. I have a directory structure like this (dir2 is inside dir1):
/dir1
/dir2
|
--- file1
|
--- file2
What is ...
3
votes
2answers
256 views
Fastest way to get list of all file sizes
I'm trying to create a graph of the distribution of file sizes on my ext4 system. I'm trying to write a script to scrape this information from my computer somehow. I don't care where the files are ...
1
vote
5answers
378 views
Run a command on all the files in a directory tree and put the output into a variable
I want to run this bash command :
#!/bin/bash
rep="*"
for f in `ls -R`$rep; do
d='git log '$f'| wc -l'
c=$d
echo $c
done
how to excute a command git log myFile | wc -l from bash ?
ps : this ...
4
votes
2answers
1k views
Recursive glob?
I'd like to write something like this:
$ ls **.py
in order to get all .py filenames, recursively walking a directory hierarchy.
Even if there are .py files to find, the shell (bash) gives this ...
2
votes
1answer
1k views
How can I queue up an entire directory for FTP?
Currently I know how to do this:
curl -T file.zip ftp://server.domain.com/ --user username:password
Which will let me do a single file. However I can't figure out how to do it for a directory. I ...
4
votes
3answers
432 views
How can I list all *.doc files in a Zip archive, including files in subdirectories?
I have Zip files, that might look like this:
$ zipinfo -1 zip.zip
doc.doc
dotx.dotx
xls.xls
ppt.ppt
txt.txt
c.c
subdir/subdir2/doc.doc
subdir/xls.xls
subdir/ppt.ppt
subdir/c.c
subdir/txt.txt
...
3
votes
3answers
389 views
id3v2 used recursively at command line?
Trying to get my id3 tags cleaned up and am loving id3v2 on the command line -- but I've been using it only with a *.mp3 wildcard and want to explore if there's a way to use it recursively so I can ...
3
votes
2answers
1k views
How can I search a wild card name in all subfolders?
How can I search a wild card name in all subfolders? What would be the equivalent of DOS command: dir *pattern* /s in *nix?
8
votes
2answers
3k views
Locate and delete all temporary files in user directory
I use vim a lot, and my area has power failure a lot. So the resultant is I get many *.swp files scattered over my PC.
I want an alias of rm command that removes all files with either .swp, ~, ...
1
vote
1answer
4k views
How do I remove a directory and all its subdirectories?
I'm trying to learn some directory navigagtion with bash and all I know is that
rmdir directoryname
will remove the directory but not if it's containing something. Is there a way to force it to ...
5
votes
1answer
691 views
Search for a string in files recursively in BusyBox 1.0? [duplicate]
Possible Duplicate:
How to grep a text recursively on BusyBox 1.0?
How can I search for a string in a file recursively in BusyBox 1.0 if find and grep are not available ?
(I want to telnet ...
4
votes
2answers
2k views
Difference between cp -r and cp -a
Looking for the difference between cp -r and cp -a? What does recursive mean in terms of copying files from a folder?
0
votes
1answer
198 views
PHP file recursive change array key on find [closed]
I used PHP array
$lang['module']['1'] = 'Title';
$lang['module']['2'] = 'Title2';
$lang['value'] = 'text123';
how i can use replace in terminal Key Value to CASE UPPER ?
$lang['VALUE']
...
5
votes
2answers
2k views
Where does grep -r search by default?
I found if I search using grep without specifying a path, like grep -r 'mytext' it takes infinitely long. Meanwhile if I search with path specified grep -r 'mytext' . it instantly finds what I need. ...
1
vote
3answers
125 views
line count on all the PHP scripts within my webroot with wc
How can I do a line count on all the PHP scripts within my webroot?
I am trying something like this below to no avail:
wc -l *.php
2
votes
2answers
322 views
Search for file permisions other than 755
In AIX really, how can I search in several directories and those below it, for files that are not of the specific permissions of 755.
So I want to search /path/to/, /path/to/mydir, ...