Issue
I have a bunch of directories, named like this:
- 5553_DirHere
- 5554_DirHere
- 5555_DirHere
How can I run a shell command, to find all directories with the name "5554"?
The shell script would be something like:
find /mnt/Desktop -type d -name "5554*"
Then save the output to a variable
This is what I have tried:
const getDownloadPath = name => {
const folderDir = 5554;
exec('find /mnt/Desktop -type d -name ${folderDir}*', function(err, stdout, stderr)
{
if(err) console.error(stderr);
const singleFolder = stdout;
});
return `${config.path}/${stdout}`;
};
};
Solution
'Find' command can be slow when searching larger directories. I used file-system, which works perfectly.
Answered By - eengstroem