delete files with spaces in their names -

Post here if you are a new Porteus member and you're looking for some help.
User avatar
abelM
Black ninja
Black ninja
Posts: 50
Joined: 22 Oct 2017, 12:35
Distribution: Porteus v-3.2.2 64 bit
Location: Argentina
Contact:

delete files with spaces in their names -

Post#1 by abelM » 02 Nov 2017, 23:20

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,

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

delete files with spaces in their names -

Post#2 by Ed_P » 03 Nov 2017, 01:58

Ed

User avatar
abelM
Black ninja
Black ninja
Posts: 50
Joined: 22 Oct 2017, 12:35
Distribution: Porteus v-3.2.2 64 bit
Location: Argentina
Contact:

delete files with spaces in their names -

Post#3 by abelM » 03 Nov 2017, 11:56

Thank you Ed! I'm going there then.

Post Reply