General :: Recursively Cp All Directories, Files And Hidden Files?
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
ADVERTISEMENT
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
Sep 26, 2010
I need to strip the executable flag from all files within a certain directory and sub directories. Right now I'm doing it with a 2 step process
find /dir/ -type f -exec chmod ugo-x {} ;
find /dir/ -type d -exec chmod ugo+rx {} ;
Is it possible to modify the first line so that I can strip exec flag from all non-directory files? Since this needs to be done on a fairly regular basis across a lot of directories and files, I'd prefer not to use a bash script which would slow it down.
View 1 Replies
View Related
Jul 22, 2011
suppose in my current directory, I have 50 sub-directories. Now, I am interested only in about 20 of those sub-directories (whose names match a pattern). I would like to recursively list the contents of these 20 sub-directories. How do I do that ? I would like to do this in Solaris 10 and Linux(RHEL 5.x).
View 3 Replies
View Related
Jan 31, 2010
I need to replace ":" from multiple files names, since I am going to copy those files from a linux partition, which admit the ":" to a FAT32 partition, which does not.
Example:
original name: eg06_ana_21-05-06_09:21:03.JPG
wished name: eg06_ana_21-05-06_09-21-03.JPG
I have googled a lot but I have not been able to adapt the examples given by people to my aim.
It seems that rename command is what I should use, but I have no idea to build the correct pearl expression.
View 3 Replies
View Related
Aug 23, 2010
I am to rename all the files within a directory (which contains multiple subdirectories) recursively without invalid characters.
I tried the coding posted above.
find . -type f -printf '%p
' | while read file; do
oldfile=$(basename "$file")
newfile=$(echo "$oldfile" | sed 's/[^A-Za-z0-9_.]/_/g')
if [ ! "$newfile" == "$oldfile" ]; then
echo mv "$file" "${file%$oldfile}$newfile"
code....
but I get an error on both of them stating "find: bad option -printf find: [-H | -L] path-list predicate-list"
View 9 Replies
View Related
Mar 28, 2011
I am trying to understnd where java preferences are stored based on web search I understand they are somewhat like windows registry - stored out there somewhere. web suggested things like hidden files or directories - and i've look all over th eplace withour result on Fedora 14. trying to start a program. got part way in and had given some info and then it blew. it still remembers my iput - which may have been wrong. ive looked at code and see it uses the java preferences system - wpould like to find and erase.
View 2 Replies
View Related
Aug 25, 2009
How can you create a script to move or copy files from a main directory into multiple directories below the main directory.
View 7 Replies
View Related
Dec 19, 2009
i am in need of linux help. iam at college and i need this back/restore script to pass this final part of an assessment. i require a backup script that will not only backup but also restore files to the relevent directories. e.g. users are instructed to store all wordprocessor files in a directory named wp. so i am needing to create a backup directory and 3 directories within that and some files within the 3 directories and then back them up ot restore them. l know i should/have to do this myself by been trying to get/understand info for the last few days and came up with zero.
View 14 Replies
View Related
Mar 9, 2011
I have a Kingston 8gb Datatraveler that has been giving me troubles lately. For some reason after I delete files from it it still shows up as full and the files are shown in the hidden trash files. How do I get rid of these files? I can't delete them as they just show back up. Also, I tried to format the drive with gparted and it won't unmount. When I right click and select information, at the bottom it says: Unable to find mount point. Unable to read the contents of the file system. Because of this, some operations may be unavailable.
View 1 Replies
View Related
Mar 23, 2011
I am writing a script, in that my requirement is, if all the fill types stored in one directory from that we need to separate different different directories based on the file types.
for example in a directory(anish). 5 different types files
1- directory
2- .txt files
2- .sh files
like that and my requirement is the (1- directory is moved to one new directory(dir) which we are given in the script)and (2 .txt files are moved to another new directory(test) which we are given in the script)and ( 2 .sh files are moved to another new directory(bash) which we are given in the scrip)finally the directory anish should be empty..using bash script.how it is possible !!
View 7 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 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
Jan 3, 2011
I want to list recursively all files in given direcotry, with their fullpath and their timestamps.Something like this:10:30 Dec 10 2010 /tmp/mydir/myfileI've tryied with:find . -type f -exec ls -la {} ;but that don't give me the fullpath.
View 3 Replies
View Related
Mar 1, 2011
I'm using a mac, and just transferred a bunch o photos from another computer, and as it turns out, there is a bunch of duplicates.I'm not too familiar with the mac terminal, but if there is a solution for linux, it will probably work for the mac.Just need to be able to recursively scan all folders in my Pictures folder and then Delete them.
View 1 Replies
View Related
Jun 20, 2011
At the linux command line, I'd like to compress all .pdf files in a directory, any of it's subdirectories and so on - but only .pdf files. I'm struggling to figure out the syntax
View 2 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
Jan 18, 2010
I'm under linux . by default, other user can't read anything under my home directory. let's see my home directory is /home/superman , and I tried to use
chmod +r /home/superman
to let others can acess files under my home directory , but it does not work .
View 1 Replies
View Related
Sep 9, 2009
I need a either a script or perl script that will allow me to mass rename files, folders, and sub folders. I need to replace special chars in the current file names with underscores. I was able to make this happen in a single directory, but not recursively.
Here is what does it in a single directory.
for file in *
do
mv "$file" $(echo "$file" | sed 's/[^A-Za-z0-9_.]/_/g')
done
View 8 Replies
View Related
Feb 12, 2010
I am new to linux as well as awk, grep or sed. I need a find and replace command single liner or script that loops trough input file (file1) and find the particular input in file2 and add "!" in front of the found string.
Example:
input file: file1
g+h=o+p
a+b=c+d
file2 (file that need to look for)
a+b=c+d1e105
x+y=z+s5e105
g+h=o+pabcdefg
t+r=w+qxvyderf
Output file (file3 should look like this)
!a+b=c+d1e105
x+y=z+s5e105
!g+h=o+pabcdefg
t+r=w+qxvyderf
I have tried many awk and sed method of find and replce but it did not work the way I wanted. This is mainly due to my lack of experience in awk and sed. The program should loop trough file1 and find in file2 and output in file3 for the 1st (g+h=o+p) set then repeat the same process again for set 2 (a+b=c+d).
View 14 Replies
View Related
Feb 11, 2010
I'm able to use the following to remove the target directory and recursively all of its subdirectories and contents. find '/target/directory/' -type d -name '*' -print0 | xargs -0 rm -rf
However, I do not want the target directory to be removed. How can I remove just the files in the target, the subdirectories, and their contents?
View 4 Replies
View Related
Jul 19, 2011
I would like to overwrite files in a directory tree, recursively. The ones I would like to overwrite match the filename "x_alpha*.png" and have a size exactly 456 bytes. Is there any way to search for these recursively in a directory tree, and overwrite them with a reference file, for example "e:mydirgood.png"
I am using Windows 7, but I have UnxUtils, so I can use those too. What I am looking for is something like this, generated automatically:
copy /y e:mydirgood.png e:mydiracx_alpha0023.png
copy /y e:mydirgood.png e:mydirefgx_alpha0045.png
copy /y e:mydirgood.png e:mydirhx_alpha0248.png
View 2 Replies
View Related
Jan 29, 2011
i would like to find and backup all *.mp4 files from /Pictures and its sub-directories and move them to a single directory on a remote. I can find and move the files but I don't want the directory structure...just the files to be placed in the remote directory.
To find my files I use
rsync -r -a -v -e "ssh -l user" --delete --include '*/' --include '*.mp4' --exclude '*' /home/drew/Pictures/ remoteserver:/Users/drew/mp4
but this creates all the subdirectories
I also tried
find ~/Pictures -name "*.mp4" -exec rsync -r -a -v -e "ssh -l user" --delete {} remote:/Users/drew/mp4 ;
This works but takes forever
View 3 Replies
View Related
Feb 10, 2011
What should do? Or how to delete that I have 2 hidden in my PC?
I know nothing that's why please tell me detail if some one know about it?
View 5 Replies
View Related
Feb 15, 2010
how to list only hidden files in current directory ?
View 7 Replies
View Related
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
View Related
Mar 24, 2011
I'm trying to make a shell script that will list the 50 newest files in a directory with several subdirectories in. I've been trying with the find-command with no luck and now I've figured I should probably use ls. The problem is when I do "ls -lRt | head -50" it will do 1 directory at the time. It will not first make the full list and then sort it. This will display all items in first directory, sorted, then the newest directory will be sorted and displayed. So I figured I have to sort the whole process of ls before I limit the head. So this is where I am at now: ls -lRt | sort <something clever here> | head -50
Only doing a "|sort|" will sort it by name if I understand it right and I don't know how to solve it. Here's also my first attempt if that is of any interrest or help, this was limited by the change status time of files (so some lists got very large). These lists dit not get sorted by time and I could not find any way to do so.find $ftpDir -ctime $time -type f -print > $ftpFileLsAny help on this would be appreciated since I'm sort of stuck now. After reading manuals for all the options I can think of and still there's just a big blur in my head..
View 12 Replies
View Related