nsz
nsz copied to clipboard
Scanning directories recursively
Currently when running nsz -C \path\to\roms\
to compress all roms, only those within that level directory will be compressed. Any roms within \path\to\roms\subdirectory\
will be ignored. Can functionality be added to scan all subdirectories within a target?
Thanks!
It would be great if we could input 'src-folder' and it gets compressed and replicated to 'dest-folder' with all subdirectories.
Great feature request. I especially like the idea about replicating the folder structure. I will have to think about how to implement this the best way. There are a lot command line options like --undupe that currently relay on everything being in the same directory. Probably I will end up treating every directory and sub directory separately as if you would separately call NSZ for each of them. This would avoid almost all edge cases and likely be what behavior the user expects.
Curious if this was ever implemented as i also was looking for this feature.
Curious if this was ever implemented as i also was looking for this feature.
No as otherwise the issue would be closed. This is currently together with adding support for sparse storage games the next features I will implement. If you need this now just write a simple script that calls nsz for every subfolder or implement it by your own and create a pull request. It's actually quite easy to implement by treating every subfolder separately.
Sorry for being so inactive lately. I was quite busy finishing university and finding a job. I will start with my job next week after which I will probably have more time again.
If using macOS or Linux, you can use some bash sorcery: create a bash script (let's call it nsz.sh
) with the following:
#!/usr/bin/env bash
if [[ $# -lt 1 ]]; then
echo "Please provide a source directory so all children will be scanned."
exit 1
fi
if [[ ! -d "$1" ]]; then
echo "$1 is an invalid directory."
exit 1
fi
while IFS='' read -r -d '' directory; do
# Using a subshell with () means we don't need to be calling "cd .." after each iteration
(
cd "$directory" || {
echo "Can't cd into $directory!"
exit 1
}
echo $directory
# uncomment nsz call below if the directory above is printing correctly
# all your directories and save this script somewhere in your $PATH.
# nsz -C .
)
# -not -name . is a little hack to avoid printing the folder itself
done < <(find . -type d -not -name . -print0)
Put somewhere in your $PATH
and call nsz.sh <root directory>