5 added 124 characters in body
source | link

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be shown exactly which line(s) in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Note that I save the full path to each file in the output file. This does not matter since the directory path is static.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data (this would generate diff output when even the last-access timestamp on a file changed). Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be shown exactly which line(s) in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data (this would generate diff output when even the last-access timestamp on a file changed). Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be shown exactly which line(s) in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Note that I save the full path to each file in the output file. This does not matter since the directory path is static.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data (this would generate diff output when even the last-access timestamp on a file changed). Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

4 added 3 characters in body
source | link

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be shown exactly which line(s) in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data (this would generate diff output when even the last-access timestamp on a file changed). Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be shown exactly which line in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data. Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be shown exactly which line(s) in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data (this would generate diff output when even the last-access timestamp on a file changed). Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

3 added 1 character in body
source | link

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be showshown exactly which line in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data. Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be show exactly which line in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Change echo to ls -l if you want to also compare timestamps etc.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

Counting the number of letters in the filenames would not be a safe way of detecting a renamed filename.

Instead, create a simple file listing of the names, and compare it to an existing list. By using diff, you would be shown exactly which line in the list had changed.

#!/bin/sh

LC_ALL=C

newlist=$HOME/filelist.new
oldlist=$HOME/filelist.old

echo /usr/hdp/2.6.4.0-91/tez_hive2/lib/*.jar >"$newlist"

if [ -f "$oldlist" ]; then
    diff -u "$oldlist" "$newlist"
fi

mv "$newlist" "$oldlist"

Obviously, the first time you do this, filelist.old would not exist, so the diff would not run.

Change echo to ls -l if you want to also compare timestamps etc. Change it to stat if you want to compare even more meta data. Install wdiff and change diff to wdiff to get a word-based diff rather than a line-based one.

The LC_ALL=C is to guarantee a consistent sorting of the expansion of the shell glob.

2 added 66 characters in body
source | link
1
source | link