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.
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 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
Beginner/Intermediate shell; comfortable in the command line.
I have been looking for a solution to a backup problem. I need to compare Directory 1 to Directory 2 and copy all modified or new files/directories from Directory 1 to Directory 3. I need the directory and file structure to be mirrored on Directory 3. Another way of thinking about the logic is: Dir1 - Dir2 = Dir3.
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 ,
please help me in this context
pkg1_name="/dir1/dir2/dir3/pkg1.txt"
pkg2_name="/dir1/dir2/dir4/pkg2.txt"
.
.
.
input to the script is pkg1 or pkg2 or ...
i have used pkg variable to save input i.e.
pkg=$1
now i need the following
result=`awk something ${pkg}_name ` for each file
but the output is showing error as
pkg1_name : no such file or d
Hi All,
Please help.
I have got a file which contains a listing of a file and some directories after it, one by one. I am calling this file xyz.txt here
Code:
file1
dir1
dir2
dir3
dir4
file2
dir5
dir6
dir7
dir8
file3
dir9
dir10
dir11
dir12
Requirement is that I have to pick the files one by one from xyz.txt file i.e. file1 then file2 then file3 ...
Hi Folks,
As part of my application I need to find out what the latest directory based
on the name of that directory (not it's file system timestamp).
Example: I have a directory which contains below directories (each of while contains files etc)
20120000/
20120000/
latest (symbolic link to 20120000)
So in this case the latest directory is latest and 20120000
If a new directory called 20130000 get