forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help please [SOLVED]

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Fri Apr 13, 2012 4:03 pm    Post subject: Help please [SOLVED] Reply with quote

Hi,

I need to create a script where when I drag&drop files and folders populate a table with filename and it's folder name

like
I drag folder c:\pippo have a structure
+c:\pippo
|-file1
|-file2
+-folder2
|-file3
|-file4
+folder3
|-file5
|-file6

return a list like
file1|pippo
file2|pippo
file3|folder2
file4|folder2
file5|folder3
file6|folder3

I tried in some ways without success Stupid


Last edited by Tdk161 on Mon May 21, 2012 3:08 pm; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail
LiquidCode
Moderator Team


Joined: 05 Dec 2000
Posts: 1753
Location: Space and Time

PostPosted: Sat Apr 14, 2012 11:54 pm    Post subject: Reply with quote

You had asked for something like this before. Take a look at this. You should be able to modify it to do what you need.

http://forum.vdsworld.com/viewtopic.php?t=5234&highlight=recurse+directory

_________________
Chris
Http://theblindhouse.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Claz
Newbie


Joined: 03 Jan 2009
Posts: 23
Location: The Netherlands

PostPosted: Sun Apr 15, 2012 4:24 pm    Post subject: Reply with quote

Hi Tdk161,

I assume that in fact you want to create a directory structure from a given rootfolder, C:\pippo in your example.
Try the script hereunder to see if this is what you are looking for.

Good luck!
Claz


#FoldersFilesList

%%Modal = 0

List create,1
List create,2

DIALOG CREATE,Folders and Files List,-1,0,1202,655
REM *** Modified by Dialog Designer on 15-4-2012 - 17:56 ***
DIALOG ADD,TEXT,TEXT1,14,10,68,16,Rootfolder:
DIALOG ADD,EDIT,RootFolder,30,8,500,18,%%RootFolder
DIALOG ADD,BUTTON,BrowseFolder,28,512,32,20,...
DIALOG ADD,LIST,FolderList,52,6,538,572
DIALOG ADD,TEXT,TEXT2,36,554,44,12,Files:
DIALOG ADD,TABLE,Files,52,554,630,574,File[120]|Folder
DIALOG ADD,STATUS,STATUS1,STATUS1
DIALOG SHOW

Goto BrowseFolderButton

:Refresh
# Create list of folders & subfolders....
List clear,1
List clear,2
List clear,Files
List clear,FolderList
List add,FolderList,%%Rootfolder
List filelist,1,%%RootFolder,D
# List 1 will hold a list of subfolders each time,
# List 2 will hold a list of subsubfolders each time
# FolderList is the list of all folders and subfolders
# Files is the list of all files in all folders

While @greater(@count(1),0)
List append,FolderList,1
%N = @count(1)
%%Folders = @sum(%%Folders,%N)
%C = 0
While @greater(%N,%C)
%%Folder = @item(1,%C)
List filelist,2,%%Folder,D
%C = @succ(%C)
Wend
List clear,1
List assign,1,2
List clear,2
Wend

#Create list of all files in all folders from rootfolder....
%N = @count(FolderList)
List clear,2
%%Folders = %N
%C = 0
While @greater(%N,%C)
List clear,1
%%Folder = @item(FolderList,%C)
List filelist,1,%%Folder
List append,2,1
%C = @succ(%C)
Wend

%N = @count(2)
%C = 0
While @greater(%N,%C)
%F = @item(2,%C)
List add,Files,@name(%F).@ext(%F)@tab()@path(%F)
%C = @succ(%C)
Wend
Dialog set,status1,Folders: %%Folders|No of files: %N

:EvHandler
WAIT event
%%EventDialog = @event(D)
Parse "%%Event;%%Dialog",%%EventDialog
if @equal(%%Modal,%%Dialog)
GOTO %%Event
end
goto EvHandler

:BrowseFolderButton
%%Rootfolder = @dirdlg(Select rootfolder,%%Rootfolder)
if %%Rootfolder
Dialog set,Rootfolder,%%Rootfolder
Goto Refresh
else
GOTO EvHandler
end


:Close
:CloseButton
List close,1
List close,2
Exit
Back to top
View user's profile Send private message
Tdk161
Valued Contributor
Valued Contributor


Joined: 08 Feb 2005
Posts: 399
Location: ITALY

PostPosted: Mon Apr 16, 2012 6:32 pm    Post subject: Reply with quote

@LiquidCode
Thank you, I remember this post, but unfortunatly isn't whant I need Crying or Very sad

@Claz
Thank you very much, your code is what I needed Very Happy and works very fast Very Happy Very Happy


Cheers Very Happy
Back to top
View user's profile Send private message Send e-mail
Claz
Newbie


Joined: 03 Jan 2009
Posts: 23
Location: The Netherlands

PostPosted: Mon Apr 16, 2012 6:45 pm    Post subject: Reply with quote

Hi Tdk161,

Glad I was able to help you. Good luck with your ptoject.

Claz
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group