Can the inputfolder command return Short Path Names
Posted: 29 Sep 2009 21:41
Is there a way to make the inputfolder command return the Short Path Names of a selected folder instead of the full path name.
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
No, and I'd rather give you an extra function to convert long to short names. But only if you tell my for what you need it.Lare2 wrote:Is there a way to make the inputfolder command return the Short Path Names of a selected folder instead of the full path name.
Code: Select all
/*------------------------------------------------------------------------------
This script is the default entry point.
------------------------------------------------------------------------------*/
"Main"
Sub("_setPaths"); //Declare and set the global vars.
Load("*", "_clipboard;_curItem"); //Load the desired menu, which can now use the global vars.
/*------------------------------------------------------------------------------
This script sets the global variables to be used by other WGET SCRIPTS.
------------------------------------------------------------------------------*/
"_setPaths"
Global $wget, $target;
$wget = <xypath>\wget\wget; // WGET EXE PATH
$target = C:\DOCUME~1\Carlos\Desktop\Downloads; // TARGET DOWNLOAD FOLDER
/*------------------------------------------------------------------------------
01 D O W N L O A D F R O M C L I P B O A R D
This script will download the URL on the clipboard
WGET ARGUMENTS = run """cmd"" /k ""[WGET PATH]"" --directory-prefix=[TARGET PATH] [URL]"
------------------------------------------------------------------------------*/
"Download File On Clipboard : _clipboard"
Global $wget, $target;
msg Would you like to download the following <br><br> <clipboard>, 1; // CONFIRM URL TO DOWNLOAD WITH MESSAGE BOX
run """cmd"" /k ""$wget"" -c --directory-prefix=$target <clipboard>"; // WGET COMMAND ARGUMENTS
/*------------------------------------------------------------------------------
02 D O W N L O A D F R O M F I L E
This script will attempt to download a series of links from a TXT file.
------------------------------------------------------------------------------*/
"Download From Links On Selected File : _curItem"
Global $wget, $target;
$linktxt = readfile(<curitem>);
msg The following files will be downloaded <br><br>$linktxt, 1;
run """cmd"" /k ""$wget"" -c --directory-prefix=$target --input-file=<curitem>";
Code: Select all
$target = C:\DOCUME~1\Carlos\Desktop\Downloads; // TARGET DOWNLOAD FOLDER
Code: Select all
inputfolder $target, c:\ , Select the target folder;
It's not so much that you need the short name as you need to quote the path since it contains spaces.Lare2 wrote:When i tried the above, WGET (cmd program) truncates the path. If I select Desktop from the dialog box then WGET truncates the path to C:\Documents instead of C:\Documents and Settings\user\Desktop\
Code: Select all
/*------------------------------------------------------------------------------
This script is the default entry point.
------------------------------------------------------------------------------*/
"Main"
Sub("_setPaths"); //Declare and set the global vars.
Load("*", "_clipboard;_curItem"); //Load the desired menu, which can now use the global vars.
/*------------------------------------------------------------------------------
This script sets the global variables to be used by other WGET SCRIPTS.
------------------------------------------------------------------------------*/
"_setPaths"
Global $wget, $target;
$wget = "<xypath>\wget\wget"; // WGET EXE PATH
$target = "C:\DOCUME~1\Carlos\Desktop\Downloads"; // TARGET DOWNLOAD FOLDER
/*------------------------------------------------------------------------------
01 D O W N L O A D F R O M C L I P B O A R D
This script will download the URL on the clipboard
WGET ARGUMENTS = run """cmd"" /k ""[WGET PATH]"" --directory-prefix=[TARGET PATH] [URL]"
------------------------------------------------------------------------------*/
"Download File On Clipboard : _clipboard"
Global $wget, $target;
msg "Would you like to download the following <br><br> <clipboard>", 1; // CONFIRM URL TO DOWNLOAD WITH MESSAGE BOX
run """cmd"" /k ""$wget"" -c --directory-prefix=""$target"" ""<clipboard>"""; // WGET COMMAND ARGUMENTS
/*------------------------------------------------------------------------------
02 D O W N L O A D F R O M F I L E
This script will attempt to download a series of links from a TXT file.
------------------------------------------------------------------------------*/
"Download From Links On Selected File : _curItem"
Global $wget, $target;
$linktxt = readfile("<curitem>");
msg "The following files will be downloaded <br><br>$linktxt", 1;
run """cmd"" /k ""$wget"" -c --directory-prefix=""$target"" --input-file=""<curitem>""";
I'd simply do this:admin wrote:Try to quote your $target in the run command...
Generally: Are quotes very expensive where you come from? Your code really could need some more...
Code: Select all
inputfolder $target, "c:\" , "Select the target folder";
//put the quotes into the var
$target = quote($target);