Page 1 of 1

delete files with spaces in their names -

Posted: 02 Nov 2017, 23:20
by abelM
Hi all!
There's a previous post about this issue marked as [Solved] but deleting whiteouts and files by hand is a cumbersome task. See viewtopic.php?p=28192#p28192 . I think a different solution could be found for the same problem.

Let's take a deleted file named my file. I've run a little script using some lines from dump-session to see what happens:

Code: Select all

FOLDERS=`grep '^/' /etc/changes-exit.conf | sed s/^.//g`
MNAME=/mnt/live/memory/images/changes
for x in `find $FOLDERS -name ".wh.*" 2>/dev/null | sed s/.wh.//g`; do  ls -l $MNAME/$x; done
for y in `find $MNAME -name ".wh.*" 2>/dev/null`; do ls -l $y; done

ls: cannot access '/mnt/live/memory/images/changes/root/.wh.my': No such file or directory
ls: cannot access 'file': No such file or directory
Now let's set Internal Field Separator to <newline>

Code: Select all

IFS="
"
FOLDERS=`grep '^/' /etc/changes-exit.conf | sed s/^.//g`
MNAME=/mnt/live/memory/images/changes
for x in `find $FOLDERS -name ".wh.*" 2>/dev/null | sed s/.wh.//g`; do  ls -l $MNAME/$x; done
for y in `find $MNAME -name ".wh.*" 2>/dev/null`; do wh=`echo $y | sed -e s^$MNAME^^g -e s/.wh.//g`; do ls -l $y; done
unset IFS

-r--r--r-- 5 root root 0 Nov  2 16:43 /mnt/live/memory/images/changes/root/.wh.my file
I'd like to know what you think. Regards,

delete files with spaces in their names -

Posted: 03 Nov 2017, 01:58
by Ed_P

delete files with spaces in their names -

Posted: 03 Nov 2017, 11:56
by abelM
Thank you Ed! I'm going there then.