We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

How can I alter the move code to run it in run command when there are no files?

Denisa_Grecu
8 - Asteroid

Hello,

 

I have an issue with the move run command giving me an error when there are no files to move.

This is the code I use at the moment: 'move "' +[User.LocalPath]+ "\*.xlsm*"+'"'+' "'+[User.LocalPath]+'\'+[year]+"\"+[DATE FICHIER]+'"'

How can I alter the code above to run it in run command when there are no files?

 

Best regards,

Denisa Grecu

2 REPLIES 2
ArnaldoSandoval
12 - Quasar

Hi @Denisa_Grecu 

 

I found this MS-DOS batch file that check if folders are empty, perhaps you may extend it so your "move" code happens when it detect "Not Empty" folders.

How can I check if the folder is empty or not in batch script?  

 

I adapted the batch file to my environment:

call :ReportFolderState "%USERPROFILE%\Documents"
call :ReportFolderState "d:\temp\Empty"
call :ReportFolderState "d:\temp\ZZZ"
call :ReportFolderState "d:\temp"
pause
@exit /b

:ReportFolderState
@call :CheckFolder "%~f1"
@set RESULT=%ERRORLEVEL%
@if %RESULT% equ 999 @echo Folder doesn't exist
@if %RESULT% equ 1 @echo Not empty!
@if %RESULT% equ 0 @echo Empty!
@exit /b

:CheckFolder
@if not exist "%~f1" @exit /b 999
@for %%I in ("%~f1\*.*") do @exit /b 1
@exit /b 0

 

hth

Arnaldo

KerryW
7 - Meteor

I think like the directory tool, the process needs a file to not error.

 

As a work around I have been using a seed file  like "seed.xlsm"  move the file to [User.LocalPath] and back within the same workflow so its never empty. 
I then filter the file names to eliminate the seed file

Labels
Top Solution Authors