Possible Duplicate:
Why does this compound command report errors when copying directories?
if one executes the following two commands in one line, as follows,
rm -rf dir ; cp -r dir2 dir
it may complain that cp can not create directory dir/subdir: File exists
but if these two commands are executed in two lines, no errors will be thrown.
Anybody uses Fedora 17/18 please try this testing:
create 4 directories:
% sudo su -
% mkdir /dir1 /dir2 /mnt/dir1 /mnt/dir2
exportfs and mount your dir1 and dir2 to your server (the same server: mylinux)
add 2 lines in /etc/exports to export:
/dir1 mylinux(ro)
/dir2 mylinux(ro)
add 2 lines in /etc/fstab to mount:
mylinux:/dir1 /mnt/dir1 nfs noauto,ret
I have 2 directories
DIR1 contains file1, file2
DIR2 contains file1, file3
Is there a way to replicate DIR1 to DIR2.
means,
if i give,
cp -r DIR1/* DIR2
file1 in DIR2 gets replaced with file1 in DIR1.
file2 in gets copied to DIR2.
file3 remains untouched.
But, i need DIR2 to be the exact replica of DIR1.
I need to create a symlink for every item of dir1 (file or directory) inside dir2. dir2 already exists and is not a symlink.
I have multiple hard drives with the same directory hierarchy, for example:
/media/sda/dir1
/media/sda/dir2
...
/media/sdb/dir1
/media/sdb/dir2
Two hard drives with similar names and similar directory names.
I want to create separate symbolic links to dir1 and dir2 on every hard drive.
The easiest way I have found is to use cp -sR:
cp -sR /media/sd*/dir1 /somedir/dir1
cp -sR /media/sd*/dir2 /s
I have a list of relative paths such as this:
dir1
dir2
dir2/dir3
dir2/file1
dir3/file2
dir3/dir4
dir3/dir4/file3
In the example above, the specifier dir2/file1 (for example) is redundant, because the dir2 entry would include this file.
Want I want to do, essentially, is remove redundant paths from a given list of paths.
Hello All,
I am in the process of finding the permissions on all the files that exists in two directories:
Dir1: PROD_Scripts/*
Dir2: STAGE_Scripts/*
Both the Directories have some shell and perl scripts respectively.
Step1: Finding all the Scripts that exists in PROD but Not in STAGE.
I found out Using diff Dir1 Dir2 and got 17 Scripts that exists in PROD but not in STAGE
Step2:
Hi,
I want to know how to find the latest modified directory.
I know that the command 'ls -rtl' gives the latest modified file/directory at the end.
But my specific requirement is: If I create two directories named dir1, dir2 in the same order. so now my latest modified directory is "dir2". Now inside each directories, I created a file.
Hi,
I want to know how to find the latest modified directory.
I know that the command 'ls -rtl' gives the latest modified file/directory at the end.
But my specific requirement is: If I create two directories named dir1, dir2 in the same order. so now my latest modified directory is "dir2". Now inside each directories, I created a file.