hsync: renamed syncer to hsync, + a few bug fixes
parent
94a52fa46a
commit
2ca9e82109
|
@ -98,7 +98,7 @@ auto-resize-window=false
|
||||||
zoom-step=0.10
|
zoom-step=0.10
|
||||||
default-font-family=sans-serif
|
default-font-family=sans-serif
|
||||||
ssl-untrusted-color=#ff0000
|
ssl-untrusted-color=#ff0000
|
||||||
plugin-blocker=false
|
plugin-blocker=true
|
||||||
startpage=dwb:bookmarks
|
startpage=dwb:bookmarks
|
||||||
normal-completion-bg-color=#151515
|
normal-completion-bg-color=#151515
|
||||||
cursive-font-family=serif
|
cursive-font-family=serif
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
#!/bin/awk -f
|
#!/bin/awk -f
|
||||||
|
|
||||||
function _printhelp() {
|
function _printhelp() {
|
||||||
print "Usage: " ARGV[0] "[-vr=1] SOURCE TARGET"
|
print "Usage: hsync [-vr=1] SOURCE TARGET\n"
|
||||||
print "\nMove files in TARGET identical to files in SOURCE such that they follow the same hierarchy."
|
print "Filesystem Hierarchy synchronizer."
|
||||||
print "\nSymlinks are ignored."
|
print "Move files in TARGET identical to files in SOURCE such that they follow the same hierarchy."
|
||||||
print "\nSet 'r' to 1 to actually run the process."
|
print "Symlinks are ignored."
|
||||||
|
print "Set 'r' to 1 to actually run the process."
|
||||||
}
|
}
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
@ -50,7 +51,7 @@ BEGIN {
|
||||||
target[sum]=$0
|
target[sum]=$0
|
||||||
}
|
}
|
||||||
|
|
||||||
print "\n==> Syncing from " ARGV[1] " to " ARGV[2]
|
print "\n==> Syncing hierarchy from " ARGV[1] " to " ARGV[2]
|
||||||
for (i in target)
|
for (i in target)
|
||||||
{
|
{
|
||||||
split(i, subi, SUBSEP)
|
split(i, subi, SUBSEP)
|
||||||
|
@ -59,14 +60,22 @@ BEGIN {
|
||||||
dirname=source[subi[1]]
|
dirname=source[subi[1]]
|
||||||
sub(/[^/]+$/, "", dirname)
|
sub(/[^/]+$/, "", dirname)
|
||||||
|
|
||||||
## We only create a new folder if necessary.
|
## Target -> Source
|
||||||
if (dirname)
|
change="'" ARGV[2] "/" target[subi[1]] "' '" ARGV[2] "/" source[subi[1]] "'"
|
||||||
cmd="mkdir -p " ARGV[2] "/" dirname " && mv " ARGV[2] "/" target[subi[1]] " " ARGV[2] "/" source[subi[1]]
|
|
||||||
else
|
|
||||||
cmd="mv " ARGV[2] "/" target[subi[1]] " " ARGV[2] "/" source[subi[1]]
|
|
||||||
|
|
||||||
print cmd
|
## We only create a new folder if necessary.
|
||||||
if (run)
|
cmd="[ ! -d '" dirname "' ] && mkdir -p \"" ARGV[2] "/" dirname "\" && mv -n " change
|
||||||
|
# if (dirname)
|
||||||
|
# {
|
||||||
|
# print "### NARJ"
|
||||||
|
# cmd="[ ! -d ] \'" dirname "\' && mkdir -p \"" ARGV[2] "/" dirname "\" && mv -n " change
|
||||||
|
# }
|
||||||
|
# else
|
||||||
|
# cmd="mv -n " change
|
||||||
|
|
||||||
|
## TODO: sort preview.
|
||||||
|
print change
|
||||||
|
if (r)
|
||||||
system(cmd)
|
system(cmd)
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue