Go Back   FlashFXP Forums > >

FlashFXP v5.x Public Beta Please direct all comments, suggestions, bug reports, and feedback for public beta releases to this forum.

Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 06-08-2015, 05:27 AM   #1
brackebuschtino
Member
FlashFXP Registered User
 
Join Date: Feb 2012
Location: /dev/null
Posts: 40
Default Feature Request: Extended Move command creating symlinks from source to target

Hello,

i frequently stumble upon directories i have to move to another location. I do this via the right-click -> move option. What i am missing is to have FFXP create a symlink on demand (e.g. toggle a checkbox in the popup window when defining the target directory).
May it be possible to add this feature?
brackebuschtino is offline  
Old 06-08-2015, 01:19 PM   #2
bigstar
FlashFXP Developer
FlashFXP Administrator
ioFTPD Beta Tester
 
bigstar's Avatar
 
Join Date: Oct 2001
Posts: 8,012
Default

I will consider adding an option like this.

However only a few FTP servers brands are capable of creating symlinks. Many do not support this feature because it is not part of the core FTP standard. I know that ProFTPD uses SITE SYMLINK src dst but I am unsure if other FTP server brands use other variants of this.

For SFTP servers I believe most of them do unless there is an issue with the user/file permissions.
bigstar is offline  
Old 06-08-2015, 04:19 PM   #3
brackebuschtino
Member
FlashFXP Registered User
 
Join Date: Feb 2012
Location: /dev/null
Posts: 40
Default

Thanks bigstar for your reply and your openness. I am using ioFTPD and am able to execute a command like this via the CMD+R popup window:
Code:
MKD Testdir; site chattr +l Testdir /new/path/Testdir;
I thought this might be worth an option to check.
brackebuschtino is offline  
Old 06-09-2015, 11:33 AM   #4
bigstar
FlashFXP Developer
FlashFXP Administrator
ioFTPD Beta Tester
 
bigstar's Avatar
 
Join Date: Oct 2001
Posts: 8,012
Default

I was not aware of this command for ioFTPD to create symlinks, and this got me thinking that perhaps the best way to support this is entirely via custom command scripting.

Here's what I've come up, it requires the dev build below which implements a new $selectfolder() token modifier for the /set command.

Download the dev build
https://oss.azurewebsites.net/testr/dev-bu...5.1.0.3849.zip

Unzip FlashFXP.exe into your current FlashFXP folder replacing the existing FlashFXP.exe

The new token modifier is used with the /set command as the value, the user is prompted with a folder select dialog.

/set @dst@ $selectfolder("<title>","<label>")

The result of the dialog is set to @dst@ which can be referenced later in the script, if the user cancels then the script is aborted.

Create a new raw command via > Commands > Edit Commands

Now in the raw command script for ioFTPD:
Code:
#This script is command specific to ioFTPD servers
#only allow this command to run if the remote browser is active
/require remote
# prompt the user to select the target folder
/set @dst@ $selectfolder("Create SymLink in Folder", "Select Folder:")
#For-each item selected 
{
    #perform command
    site chattr +l %f @dst@%f
}

Last edited by bigstar; 06-09-2015 at 12:00 PM.
bigstar is offline  
Old 06-10-2015, 07:00 AM   #5
brackebuschtino
Member
FlashFXP Registered User
 
Join Date: Feb 2012
Location: /dev/null
Posts: 40
Default

Thanks for the immediate dev-build. But i'm afraid there's one step missing. The folder i'd like to create a symlink for must be moved first which is why i thought it might be useful to create the symlink after moving a directory. Here's what i tried:

In the source window press "CMD+R" to open the RAW-Command dialog.
Paste the script you posted.
Press "OK".
A new dialog opens "Create Symlink in Folder" -> Select target directory.
I pasted the path of the parent directory that should contain the symlink to the directory i'd like to create the symlink for.
Press "OK".
The source directory i getting converted to a symlink and the target directory where it should have been moved to first doesn't receive it.
The output from the FFXP status window is:
Code:
[R] [CMD] /require remote
[R] [CMD] /set @dst@ $selectfolder("Create SymLink in Folder", "Select Folder:")
[R] #perform command
[R] 500 '#perform': Command not understood
[R] site chattr +l My_Directory /Path/To/Target/Directory/My_Directory
[R] 200 'chattr' Command successful.
So, this is a good beginning having one logic issue. Currently i have to move the directory first, then create a new directory myself and then use this duplicate directory to convert it to a symlink. I think from a usability point of view it would make more sense to have an option (checkbox) in the "Move - dialog" asking the user whether or not to create a symlink from the source location to the target location after moving the director(ies).
brackebuschtino is offline  
Old 06-10-2015, 08:50 AM   #6
bigstar
FlashFXP Developer
FlashFXP Administrator
ioFTPD Beta Tester
 
bigstar's Avatar
 
Join Date: Oct 2001
Posts: 8,012
Default

Sorry, I misunderstood exactly what you were trying to do.

The reason a checkbox on the move dialog wont work is because the command that needs to be performed is specific to the FTP server brand, in this case ioFTPD.

The revised code will move the folder from the current location to @dst@ and then create a symlink in the current folder pointing to the new location.

I also quoted the paths, this is needed for the /move macro, but I am unsure if site chattr command can handle them, if not you may need to remove them, but otherwise they would be needed if the folder name contains any spaces.

Code:
#This script is command specific to ioFTPD servers
#only allow this command to run if the remote browser is active
/require remote
# prompt the user to select the target folder
/set @dst@ $selectfolder("Move Folder and create SymLink", "Select Folder:")
#For-each item selected
{
    /move "%f" "@dst@%f"
    site chattr +l "%f" "@dst@%f"
}
/list
bigstar is offline  
Old 06-10-2015, 11:58 AM   #7
brackebuschtino
Member
FlashFXP Registered User
 
Join Date: Feb 2012
Location: /dev/null
Posts: 40
Default

Quote:
The reason a checkbox on the move dialog wont work is because the command that needs to be performed is specific to the FTP server brand, in this case ioFTPD.
I see.

Quote:
The revised code will move the folder from the current location to @dst@ and then create a symlink in the current folder pointing to the new location.
The code still has a bug. From the output log i read that the directory to apply the "CHATTR" command to does not exist. Here's the log:

Code:
[L] [CMD] /require remote
[L] [CMD] /set @dst@ $selectfolder("Move Folder and create SymLink", "Select Folder:")
[L] [CMD] /move "Test_Directory" "/ARCHiVE/Test_Directory"
[L] RNFR Test_Directory
[L] 350 Directory exists, ready for destination name.
[L] RNTO /ARCHiVE/Test_Directory
[L] 250 RNTO command successful.
[L] site chattr +l "Test_Directory" "/ARCHiVE/Test_Directory"
[L] 500 "Test_Directory: No such file or directory.
[L] [CMD] /list
So i added another line to fix that:
Code:
#For-each item selected
{
    /move "%f"  "@dst@%f"
    MKD "%f"
    site chattr +l "%f" "@dst@%f"
}
This finally does what i want. But i still have some individual requirements for the symlink naming. I'd like to strip some part(s) out of the target path name before it is created and use it to prepend it to the symlink name like for instance:

Quote:
name of directory to move: [Cat.No.] Test_Directory // strip and dump the substring "[Cat.No.]"
name of target directory: /ARCHiVE/Test_Directory
name of symlink: [Cat.No.] Test_Directory // prepend the dumped substring "[Cat.No.]"
I noticed you mentioned "macros".

Would you mind hinting me to a documentation for how to write FFXP macros?
Also, would you mind telling me what language is used for the RAW commands? Is there are a documentation explaining string operations?
Also, would you mind telling me how to convert that script into an ioFTPD custom command or make it executable via shortscuts to prevent me from copy+paste that script around all the time?

Last edited by brackebuschtino; 06-10-2015 at 12:25 PM.
brackebuschtino is offline  
Old 06-10-2015, 02:41 PM   #8
bigstar
FlashFXP Developer
FlashFXP Administrator
ioFTPD Beta Tester
 
bigstar's Avatar
 
Join Date: Oct 2001
Posts: 8,012
Default

Quote:
I noticed you mentioned "macros".
Also, would you mind telling me what language is used for the RAW commands? Is there are a documentation explaining string operations?
Also, would you mind telling me how to convert that script into an ioFTPD custom command or make it executable via shortscuts to prevent me from copy+paste that script around all the time?
Macros commands are operations that are prefixed with a forward slash / and perform a desired operation with only requiring minimal information.

The language used for raw commands is custom, it is not a programming language, its sole purpose is to provide a way to simplify repetitive operations.

This is all explained in the help file, most of the information can be found under the reference section.

To create a reusable command macro you open the command editor via the main menu > Commands > Edit Commands..

Click the button to add a new command, give the command a name, and enter the command text. You can also assign a shortcut to it.

Once you save the command you'll see it listed under the commands menu.

We add one line below and make some minor changes to use regex to drop the prefix
# match <anychar><match right bracket>, set @n@ to the text following
/set @n@ $replacerx("%f", "^((.*))([\]]) (.*)$","\4")

Now we have the folder name with without the [cat no.] stored in @n@

Code:
#For-each item selected
{
    /set @n@ $replacerx("%f", "^((.*))([\]]) (.*)$","\4")
    /move "%f" "@dst@@n@"
    MKD "%f"
    site chattr +l "%f" "@dst@@n@"
}
bigstar is offline  
Old 06-23-2015, 03:08 PM   #9
brackebuschtino
Member
FlashFXP Registered User
 
Join Date: Feb 2012
Location: /dev/null
Posts: 40
Default

Thanks a bunch for your fast replies and the immediate integration of this feature!

There's one thing i think should be fixed. While having the raw command window open it should be possible to access the main application in the background to select the currently active directory paths. Currently it is not possible to copy and paste the target path (where to move the selection to) when the raw command dialog is open.

What do you think?
brackebuschtino is offline  
Old 06-23-2015, 04:51 PM   #10
bigstar
FlashFXP Developer
FlashFXP Administrator
ioFTPD Beta Tester
 
bigstar's Avatar
 
Join Date: Oct 2001
Posts: 8,012
Default

You should be able to select the folder from the move dialog or from the dropdown list provided you recently navigated to the folder or selected, the dropdown contains previous selected folders and a copy of the browser dropdown. (there is a bug where the recently navigated folders aren't being added, and it will be fixed in the next build.)

You can also pre-define the default target folder when defining $selectfolder() by passing a 3 parameter as shown below, where I might frequently use this command to move the folder to a sub-folder under /home/ftp/archive/

/set @dst@ $selectfolder("Move Folder and create SymLink", "Select Folder:", "/home/ftp/archive/")

(due to the way the folder select dialog works we can't allow access to the main dialog at the same time.)
bigstar is offline  
Old 06-23-2015, 04:55 PM   #11
brackebuschtino
Member
FlashFXP Registered User
 
Join Date: Feb 2012
Location: /dev/null
Posts: 40
Thumbs up

Quote:
due to the way the folder select dialog works we can't allow access to the main dialog at the same time.
I see. Thanks for the alternative suggestions and keep up the good work!
brackebuschtino is offline  
Closed Thread

Tags
move, target, feature, toggle, demand, e.g, create, symlink, ffxp, popup

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 01:14 AM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)