General :: Copy Permissions From One Directory Recursively To Another?

May 23, 2011

I have a system where the permissions of many files are messed up. I have another system that has the same files, if I put that hard drive in, without simply overwriting the files, is there a way where I can recursively set the permissions of each file to that of this other directory?

View 1 Replies


ADVERTISEMENT

General :: How To Recursively Copy Directory Into Another One

Apr 25, 2011

I moved to Mac OS X recently and bumped into the "feature" of Mac where copying files from an external drive resets the file modification/update date/timestamp to the current date (which Windows does not), causing a disaster for my 10+ years of backup work files where date is important. So, before I learned how to avoid that (e.g. using the -p "preserve" flag in the "cp" copy command) I have in the meantime added to my new Mac hard drive many more files as well as updating existing old files.

I have a backup external hard drive with all my old data and proper modification dates. I have a Mac hard drive with reset modification file dates (a single or two particular days). The Mac hard drive has all the "true" and "current" file contents with files modified and added. I need to Copy all the original files from the external harddrive, preserving file metadata (really only modified date), but ONLY overriding the new internal Mac hard drive IF

The file contents (md5 or whatever) is the same or The file was updated after the day (which of course I can see on all files) on which the original disasterous cope was performed (implying the file is new or modified) Ensure the copy leaves all the new and modified files completely intact on the Mac internal hard drive. "No prompting/stopping of the copy of any kind (i.e., not verbose) is required but is o.k". "Recursive copy - obviously I would like to copy all* files folders and subfolders found in export".

View 1 Replies View Related

General :: Copy File Recursively Ignoring Destination Directory Structure?

Jul 8, 2011

I have the following content on the source directory:

source/foo.txt
source/bar/another_file.txt
source/bar2/and_another.txt

I want copy those files to a destination directory which, after copy, shall look like this:

destination/foo.txt
destination/another_file.txt
destination/and_another.txt

How can I do this? It seems that "cp" lacks such an option

View 1 Replies View Related

Ubuntu :: Recursively Copy From Directory To Another Directory

Mar 23, 2010

I'm facing a little trouble with copying a .txt file(only) from a directory and subdirectory to another directory. -R command don't work I think if I want to do this, since I don't want to copy subdirectory.

View 6 Replies View Related

Ubuntu :: Recursively Changed Permissions In Home Directory

May 23, 2010

I did a clean install from Ubuntu 09.04 to 10.04 and restored my files from tar.
Everything worked fine until I tried my weekly rsync backup.
The permissions seemed to be causing problems, so I recursively changed all the permissions in my home directory:

Code:
~/Documents$ sudo chmod -R 644 /home/wolf/
[sudo] password for wolf:
chmod: cannot access '/home/wolf/.gvfs': Permission denied
So now all the directories and files have read permission for everyone:

Code:
~/Documents$ ls -A
ls: cannot open directory .: Permission denied
~/Documents$ sudo ls -lA
[sudo] password for wolf:
total 80
drw-r--r-- 2 wolf wolf 4096 2010-05-22 20:45 career
drw-r--r-- 23 wolf wolf 4096 2010-05-02 17:17 computer_languages
drw-r--r-- 2 wolf wolf 4096 2009-08-09 23:29 .ecryptfs
drw-r--r-- 21 wolf wolf 4096 2010-05-02 17:23 misc
-rw-r--r-- 1 wolf wolf 27298 2010-05-23 13:01 next.odt
drw-r--r-- 3 wolf wolf 4096 2010-05-23 15:46 PC_maintenance
drw-r--r-- 5 wolf wolf 4096 2010-05-08 01:43 software_projects
Now I can't even look at my own directory:

Code:
/home$ cd /home/
/home$ ls -lA
total 20
drwx------ 2 root root 16384 2010-05-07 01:01 lost+found
drw-r--r-- 42 wolf wolf 4096 2010-05-23 15:35 wolf
/home$ cd /home/wolf
bash: cd: /home/wolf: Permission denied
/home$ sudo cd /home/wolf
[sudo] password for wolf:
sudo: cd: command not found
/home$

View 2 Replies View Related

General :: Recursively Set Read-only Permissions?

Oct 5, 2010

I have a very large and deep directory. I would like to make all of it read only. The problem is I guess I have to distinguish between files (which will get a=r) and directories (which will get a=rx).How can I do that?

View 3 Replies View Related

General :: Recursively Download An Entire Web Directory?

Feb 3, 2010

i have a web directory that has many folders and many sub folders containing files.

i need to download everything using wget or bash.

View 7 Replies View Related

General :: Recursively Count All The Files In A Directory?

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

General :: Get The Last Change Time Of Directory Recursively

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

General :: Search LDAP Directory Recursively?

Oct 12, 2010

How would the command for recursive search in LDAP look like when I'm searching for "cn" or "ou"?

View 3 Replies View Related

General :: Recursively Add Read Privilege To All The Files Under A Certain Directory?

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

General :: Zip -x For A Directory - Subfolder Contents Not Being Excluded Recursively?

Dec 9, 2010

I am attempting to use the zip command with the '-x' option to exclude a folder e.g. 'zip upload.zip public_html -x public_html/jquery/*'. However, parts of this folder are still being added to the archive. I made a shell script (saved as 'compress.sh' and ran as '. compress.sh') to do the archiving so I could test adding nested wildards for multiple subfolder levels.

Code:

#!/bin/bash
rm -f upload.zip
zip -r upload.zip public_html
-x public_html/jquery

[code]....

Each new line I added here that has the nested wildcards made the archive file size a bit smaller. Adding more /*'s than this didn't affect the file size. Even after all this though, there were still a couple megabytes of files and folders from the 'jquery' directory that were added to the archive.

Here's some examples of files and folders that were created after I unzipped the archive:
public_html/jquery/js/tablesorter/addons/pager/icons [folder]
public_html/jquery/js/tablesorter/addons/pager/.svn/entries [file]
public_html/jquery/js/tablesorter/build/.svn/text-base/js.jar.svn-base [file]

Why is it that despite all the -x lines, the files and folders like these were still being added to the archive? How can I simply recursively exclude the entire public_html/jquery folder from the archive?

View 4 Replies View Related

General :: Recursively Remove Subdirectories And Files But Not The First Parent Directory?

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

General :: Overwriting Specific Files In Directory Tree Recursively

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

General :: Copying Jpegs Recursively While Preserving The Directory Structure?

Aug 9, 2010

So I have a bunch of directories:

dir1
dir2
dir3
etc.

which themselves all contain subdirectories:

dir1subdir1subdir2etc.and at the lowest level they contain all of these jpegs that I need. The problem is that I only need some of them. They're named like this:

pic1.jpg
pic1_med.jpg
pic1_small.jpg
pic2.jpg
pic2_med.jpg
etc.

I want to just grab the ones without the size suffix and copy them all to another set of folders, while preserving the directory structure. The numbering all starts at 1 for each low level subdirectory, so I think that the directory structure is the only way to not get them mixed up.

I know that cp has a recursive option -r but how do I just extract the ones without the underscore? And then how do I preserve the directory structure when I move them over?

View 1 Replies View Related

General :: Rsync Files Recursively But Place In One Remote Directory?

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

General :: Copy Certain File Types Recursively While Maintaining File Structure On Destination?

Jun 14, 2011

I have just been bothered by a fairly small issue for some time now. I am trying to search (using find -name) for some .jpg files recursively. This is a Redhat environment with bash.

I get this job done though I need to copy ALL of them and put them in a separate folder BUT I also need to keep the order intact after copying.

For e.g - If I get a JPG file under /home/usr/new/1/ then the destination also needs to be /test/old/new/1/.

At the moment, I am simply putting all files under /test/old/ and I can't somehow get the later /new/1/ folder path created under /test/old/

I understand this could well be done using while OR if else loop, though if someone can just guide me with a hint, I would be really grateful.

I will complete the rest of the steps and was asking here since I am still not comfortable with the shell/bash scripts yet and planning to be really good at it over the next couple of months.

View 1 Replies View Related

Debian :: Recursively Set Permissions For Certain Type Of File?

Aug 5, 2011

I want to set all directories in /example/ to +x without setting any non-directory files to +x, using the -R option of chmod. There must be a way to do this yes?

View 6 Replies View Related

General :: Using Cp Properly - Copy A Directory Somewhere Else Into This Current Directory ?

May 13, 2011

I am in my current directory. I want to copy a directory somewhere else into this current directory. Lets say I want to take it from direc1/direc2 and the directory I want to take is called demo.

Code:

That is what it shows in the man pages, but when I do that, it says cp: no match

View 5 Replies View Related

Ubuntu :: Copy Recursively While Skipping Existing Files?

Oct 7, 2010

I'm trying to copy some files via terminal because i had some issues with nautilus crashing in the middle of the operation. So how can i copy files recursively while skipping existing ones?

View 7 Replies View Related

Fedora :: Way To 'apply Permissions To Enclosed Files' Recursively Through Nautilus Context Menu?

Jun 14, 2011

I have a partition that I mount as /data on all of my distros of my multi-boot machine. I am having a bear of a time figuring the right way to address permissions/groups so that any distro can use it (or any removable drive).I tried (in linuxmint) making a group '/data' and assigning the users on my machine to that group, then changing the permissions/groups of the files and folders in that mount as belonging to the /data group, then booted to fedora 15, made the /data group, added the users to that group, I'm not sure that this way will work (it doesn't seem to) or if it's the best way to proceed. some of the things I don't get are:what is the '1000' user and group?is the user/group info on (in or somehow attached) the mount itself?does this seem like a good way to do this?is there on way to 'apply permissions to enclosed files' recursively through the nautilus context menu?

View 3 Replies View Related

General :: Move The Contents Of /public-back/templates Recursively With Permissions Into /public/templates?

Apr 20, 2011

ls -al ../public-back
drwxrwxr-x 4 apache apache 4096 Apr 19 03:32 templates
ls -al ../public-back/templates
drwxrwxr-x 2 apache apache 4096 Apr 19 03:33 content

[code]....

How do I move the contents of /public-back/templates recursively with permissions into /public/templates ?

View 2 Replies View Related

General :: Windows - Change Permissions On /var/www To Copy Files From Other Systems

Jul 16, 2011

I have a NTFS drive mounted at /media/bigbrother as my user. I have no trouble reading or writing to files here. I just created a link to /var/www using: ln -s /var/www /media/bigbrother/

The link is there however, I can't even open the folder. How should I go about getting access. So that I'm able to copy files from other systems on the network.

View 1 Replies View Related

Ubuntu :: Any Way To Recursively Invert All Images In Directory?

Jan 8, 2011

I need to invert the colors of a lot of images that are in different folders in the same directory, is there a way to use image magic or something to do this in only a few commands?

View 9 Replies View Related

Red Hat / Fedora :: Extracting Files In Sub Directory Recursively

Feb 27, 2010

I am new in Linux and I need to extract alot of zipped files (different format (e.g tar.gz, tar.gz2)) which are in subdirs and I do not want to go to each subdir and extract each file because it will take alot of time. Is there away to extract all files that are existing in dirs and subdir with "for loop" or is there a script that can do the job automatically.

View 1 Replies View Related

CentOS 5 Server :: Cp Directory Recursively With Load Check?

Nov 21, 2010

how the bash script should look to copy huge directory with multiple sub-folders to a new place place while checking load and stopping for several seconds if load reached lets say 3 or 4 ? I only know the simple command cp -r /dir/allfiles /dir/newplace However would like to copy over 30 000 files which will cause me a high load.

View 1 Replies View Related

General :: Unable To Cd To Directory Which Own With Permissions 777?

Oct 26, 2010

This is on a customized Ubuntu 10.10 LiveCD. I have a directory which the default user "ubuntu" owns, and the permissions on the directory is 777. I'm unable to cd into the directory as ubuntu user. However as root user I'm able to access it. What could be the reason? I'm able to view the directory in nautilus.Note: I originally copied the folder over from an NTFS disk.

View 1 Replies View Related

General :: What Should Be Permissions Of Home Directory?

Oct 20, 2009

I am confused that what should be the permssions of home directory because currenlty my users when they log into their home directory , they can see all the contents of /home directory as well..However if i take read all permissions then my sites are not accessible , what should i do The current permissions are 755

View 4 Replies View Related

General :: How To Traverse A Directory With Certain Permissions

Jun 30, 2011

I'm trying to create a script that when given a diretory, it goes traverses through all the subdirectories and process the files in them.However, there is one restriction.directories thatit traverses through must all have a read permission for the others group.How would I go about doing this?

View 1 Replies View Related

Fedora :: Configure Grep To Search Recursively Through All Files In A Directory?

Oct 1, 2010

somewhere lurking is a file containing the default print resolution, which is not being overwritten by printer settings or cups management. I've asked on the cup forum and nothing successful.

So here's the question:

How can I configure grep to search recursively through all files in a directory, or if need be starting from root to find the pattern "2880" I've looked in the man page for grep and I can't see how to do it, is grep the right tool to use for this ?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved