General :: Change A String Recursively In Files Located In Folders And Subfolders?
Jul 22, 2011
lets say I have a project that have generated lots of xml files. Though all these xml files point to a location with the text name TEXT15. I want to change all the files that containts TEXT15 and change it to TEXT16. This actually works for files in a folder but not recursively in all the entire files....perl -pi -c 's/TEXT15/TEXT16/g' ./* but I have many subfolders and within this more subsub folders....i just want to do this recursively.
View 2 Replies
ADVERTISEMENT
Feb 11, 2011
I need to change folders to 775 and files to 664 recursively, but this bash does not has find command (?). How can I change them recursively?
View 3 Replies
View Related
Aug 21, 2010
I am using secure delete to remove files from a Debian Linux PC. However, secure delete does not remove folders. This has lead me to look at writing a script that would move files to a predetermined folder for deletion. My plan is as follows:I have a folder on my desktop called shredder where I move the contents of the waste bin to. The script needs to identify all files within the folders and sub folders, within the shredder folder, and move each file to the shredder folder and then delete the folder. At this point secure delete can be used with a command like shred -v -u *.*on the shredder folder.The problem I have is in creating the code to move files from the different folders and then deleting the folders. Note that the names of the files, folders and subfolders will not always be known
View 12 Replies
View Related
Aug 11, 2011
Is there any Linux application for finding the folders with the most number of files? baobab sorts folders by their total size, I'm looking for a tool that lists folders by the total number of files in it.
The reason I'm looking is because copying tens of thousands of small files is excruciatingly slow (much slower than copying a few large files of the same size), so I want to archive or delete those folders with high file counts that that will be slowing down the copying (it won't speed things up now, but it would be faster when I need to move/copy it again in the future).
View 5 Replies
View Related
Jun 7, 2010
I have an archive directory that needs to be cleaned up once per quarter. The top level (/data/archive/*) directory names change daily, as well as the subdirectories and the filenames (the application names everything according to date). Also, there are two top level directories, bin and incoming, that we can't touch. I want to write a shell script that loops through the 15 or 20 top level directories and deletes all files and subdirectories older than 3 days (skipping the bin and incoming folders). Can someone get me started on a script? I am kinda new to shell scripting.
View 2 Replies
View Related
Feb 19, 2010
I wrote a script for copying mp3 files to my girlfriend's mp3-player and it looks like this:
Code:
mount /dev/sdc /test -o sync
for i in *.mp3; do
[code]...
View 13 Replies
View Related
Jan 29, 2011
I have a bunch of files on a Ubuntu box, which have various characters in their filenames that Windows doesn't accept (mostly ":" and "*", but possibly others).What's the simplest way to get these all renamed and moved to a Windows machine? It's OK to replace these characters with something like "[colon]" and "[asterisk]".
View 1 Replies
View Related
Jul 11, 2010
Let's say I want to get the size of each folder of a linux file system. When I use ls -la I don't really get the summarized size of the folders.If I use df I get the size of each mounted file system but that also doesn't help me. And with du I get the size of each subfolder and the summary of the whole file system.But I want to have only the summarized size of each folder within the ROOT folder of the file system. Is there any command to achiev that?
View 4 Replies
View Related
Aug 13, 2010
I want to get the size of each folder of a linux file system. When I use ls -la I don't really get the summarized size of the folders. If I use df I get the size of each mounted file system but that also doesn't help me. And with du I get the size of each subfolder and the summary of the whole file system. But I want to have only the summarized size of each folder within the ROOT folder of the file system. Is there any command to achieve that?
View 3 Replies
View Related
Apr 1, 2010
I just installed Karmic, but I can't copy an old user's home folder (/home/oldusername/) because everything is owned by root.I read but I'm concerned about messing up the system or the files in that old user's folder.So, how do I adjust the permissions of the files in /home/oldusername so that I can use openssh to copy them over my home network to my other computer? I have the ssh part figured out, but the files will not copy to the laptop due to permissions.
View 9 Replies
View Related
Jun 7, 2011
On my Laptop, I installed Debian under the file "/" and the partition on which I have all my files under "/var". While this isn't really a big issue, when I originally installed Debian, I had the intention of having all of my files on a partition that I would auto-mount later so that when I upgrade my system by reinstalling it, I would only have to change the system partition and let everything else stay the same.. I can live without changing my /var if I can only do so by a re-install...
View 2 Replies
View Related
Oct 22, 2010
copy string a to string b and change string b with toupper() and count the chars
View 3 Replies
View Related
Jan 2, 2010
I want to list my folders and subfolders (recursive) and also show the size of the files in terminal. I started using this:
Code:
ls -h -R > /test.txt
I got everything but not the size of the folders.
Then I tried this:
Code:
du -h --max-depth=1 > test.txt
Suppose to show me everything, but I can't see subfolders. And this command do not accept recursive. How can I show the size of the files and folders like the second command, but including the subfolders?
View 5 Replies
View Related
Feb 12, 2011
I want to rename files in multiple subfolders with a prefix (e.g., rename "file.tif" with "prefix_file.tif") and not have to be in the subfolder.
code: for f in /path/to/*; do echo mv "$f" "PRE_$f"; done
gives you this: mv /path/to/file1 PRE_/path/to/file1
instead I want this: mv /path/to/file1 /path/to/PRE_file1
View 3 Replies
View Related
May 28, 2011
How can I get the last time any of the files in a directory or its subdirectories has changed?
e.g
Dir - changed 1/1/1
Sub Dir 1 - changed 2/1/1
Sub Dir 2 - changed 3/1/1
File 1 - changed 10/1/1
File 2 - change 5/1/1
The output for this for Dir should be 10/1/1 (File 1 was the last modified one). Getting the last file name to be modified is a bonus but isn't necessary.
View 3 Replies
View Related
Mar 28, 2010
Is it possible to change only directories access permissions recursively with some linux command. I need to set x (access) permissions on directories but not execute on files. [URL]
chmod - change file access permissions
-R, --recursive
change files and directories recursively
View 2 Replies
View Related
May 17, 2010
Ubuntu 10.04
I want to copy all directories, files, and hidden files and hidden directories with one command. I want these items to replace any same items in the target directory.
I have tried several things, such as:
cp -r *
cp -aR *
but I only seem to get visible files and directories. Obviously, I am missing something. (A brain, probably....)
View 9 Replies
View Related
Feb 25, 2011
Is it possible to make a script that makes a tree of all folders and subfolders and outputs it to either a .txt file or .pdf? All folders except from one shall list 2 levels. The except folder all the way.
View 3 Replies
View Related
Jul 1, 2009
I know there exists a touch command to change the date of the files. However, I want to change the files of a directory and the directory time. Is there a command like -R. Please provide me an example of the command?
View 4 Replies
View Related
Oct 17, 2010
I have stuffed up my system and I want to remove Glib 2.20 and Glib 2.26. How can I do this? Where are the files located? Sadly, there does not seem to be a make uninstall file for Glib.
View 3 Replies
View Related
May 26, 2011
I know I can use the log file viewer to look at the logs; however, I was hoping someone can tell me exactly which folder contains the log files so I can view these files directly.
View 2 Replies
View Related
Oct 12, 2010
I have a really deep directory tree on my Linux box. I would like to count all of the files in that path, including all of the subdirectories.
For instance, given this directory tree:
/home/blue
/home/red
/home/dir/green
/home/dir/yellow
/home/otherDir/
If I pass in /home, I would like for it to return 4 files. Or, bonus points if it returns 4 files, 2 directories. Basically, I want the equivalent of right-clicking a folder on Windows and selecting properties and seeing how many files/folders are contained in that folder.
How can I most easily do this? I have a solution involving a Python script I wrote, but why isn't this as easy as running ls | wc or similar?
View 5 Replies
View Related
Jan 29, 2010
The rm command man pages discusses removing files or directories recursively. So what is meant by deleting a file or directory recursively? And what are some reasons for doing so?
View 3 Replies
View Related
Jan 22, 2011
What I would like to do is to print the contents of all text files in a particular directory, recursively. Problem being that there are directories and possibly binaries scattered around in the filesystem as well.
Trying cat * works as long as there are no directories in there, but when there are it gives an error instead and prints nothing.
I'm sure it's easy using file -f or something but I can't figure it!
View 8 Replies
View Related
May 8, 2011
I'm planning to writing a script to rename files recursively.
To be said that I'm using /bin/sh (not /bin/bash) as this is the only shell available on the busybox of the linux router (tomato) I'm using.
Basically I would like to rename files with extension .jpg using as a suffix the filename of another file in the very same directory with extension .avi
The reason for this is because pretty much all the DLNA devices like modern TV playing .avi files will display a thumbnail of the video when browsing the filesystem, however to do so they'll need .jpg image wit hthe same filename of the video in the very same directory.
View 3 Replies
View Related
Apr 15, 2010
I made an account under freeshell.org and it has been very satisfactory so far. I recommend everyone getting an account under freeshell.org. But anyways, how do I find files over, for example, 500 KB, in the entire, my shell account?
View 1 Replies
View Related
May 5, 2010
I'm a frequent user of grep. I know that I can recursively search a directory using the -r flag:
Code:
// will recursively search all files
grep -r 'some string' *
However, if I want to limit my search to PHP files, the -r flag is suddenly useless:
Code:
// for some reason, this only searches the PHP files in the current dir
grep -r 'some string' *.php
Any good way to recursively search a directory and its subdirs for a string but ONLY look at PHP or HTML files (and possibly TXT files too) ? I'm really hoping for a nice, short command that doesn't involve using an exclude file and which isn't really painful to type. I do this kind of search very frequently and have resorted to either searching EVERY file which is really slow (TAR and ZIP files really slow it down) OR typing repeated commands to search *.php, */*.php, etc.
View 6 Replies
View Related
Jun 14, 2010
I need to change the config in a folder and can not due to it being owned by root. How do I change the permissions.
Folder = /etc/stunnel/
file = /etc/stunnel/stunnel.conf
View 4 Replies
View Related
Oct 13, 2010
I've been using Ubuntu for over 5 years. This time I decided to upgrade UNR to the latest 10.10. I am now running it from USB to try it before installing. Excuse my ignorance, but whatever happened to the Terminal? I cannot find it anywhere! I think this release is not going in the right direction if one of the most important tools in Ubuntu is hidden from an average user.
Also, how do I change to the root directory in the files and folders? or at least to the higher directory structure.I won't be installing UNR 10.10 unless I figure out these BASIC things.
View 2 Replies
View Related
Nov 17, 2010
I've just read that I can't change the file permissions of files and folders if they are sitting in what was my old Windows D: drive. Is this correct? If so what is the work-around?
I don't want to have to cut and paste that entire D: drive's contents over to a recognised Ubuntu folder. I had in my mind that this D drive would continue to be my data dumping ground, to which I need read/write access to.
View 8 Replies
View Related