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.
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 am working on a site migration and I need to set up some redirects for image files.
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
So I use mkdir, intend to create two folders like this
$dir1 = 'upload/'.$id;
$dir2 = 'upload/'.$id.'/s';
if (!is_dir($dir1)){
mkdir($dir1, 0744);
mkdir($dir2, 0744);
}
This command successfully creates the two folders I need in my xampp localhost.
However in my nginx linux cloud vm, only the $dir1 can be created.
I have already give the ownership of the 'upload/' folder to nginx, and
I need to create a symlink for every item of dir1 (file or directory) inside dir2. dir2 already exists and is not a symlink.
This is probably very simple, but I can't figure it out. I have a directory structure like this (dir2 is inside dir1):
/dir1
/dir2
|
--- file1
|
--- file2
What is the best way to 'flatten' this director structure in such a way to get file1 and file2 in dir1 not dir2.
Hi guys! I'm a newbie and am learning bash. I have a couple of directories that I want to turn into an image. For example:
Quote:
/usr/dir1
/usr/dir2
I want to end up with two imgs (dir1.img and dir2.img). I wanna be able to type in:
Quote:
mkdir /usr/dir1
mount dir1.img /usr/dir1
How can I do that?
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.