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. I am just wandering what is the difference?
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
By Rand Whitehall
In the Linux command line shell, moving around from directory to directory, adding new directories, and deleting old directories is easy once you know the proper commands. Again, with Linux, you are limited only by your brain! If you know all the commands, then you weild great power.
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've a problem copying many files in different directories. Let me explain better:
Let's say I have the following in a dir:
$ ls
file1 file2 file3 file4 file5 dir1 dir2 dir3
and I want to copy every file* in every dir* with a single command.
We're quite fond of the style of the ebegin, eend, eerror, eindent etc commands used by Portage and other tools on Gentoo.
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.