MyEarth

"Convert" folder to file

18 posts in this topic

#1 ·  Posted (edited)

Hi guys,

Long time no see. I need an help with this task. I need my script treat a "folder as a file" and something don't require external DLL or software. I don't need-want any compression, fastest as possible. Just move a folder inside a "container" and extract from a "container", nothing else, but in pure autoit language.

Searching online i have see the TAR is what i can use:

https://en.wikipedia.org/wiki/Tar_(computing)#Header

But i don't have find a UDF or library in pure autoit can use that, only external software or DLL. Any suggestion-code are welcome but please remember my "requirements"

Thanks  for the help :)

 

Edited by MyEarth

Share this post


Link to post
Share on other sites



All compression related UDFs can be found here: https://www.autoitscript.com/wiki/User_Defined_Functions#Data_compression


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

I have check it out but noone seems to meet my requirements...:(

Thanks

Share this post


Link to post
Share on other sites

I'm not sure I fully understand your reqirements.
Using ZIP to create a ZIP-Archive should be all you need.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

My reqirements are:

1) Pure autoit, no external .exe or .dll

2) No compression at all, i don't need compression since compression require time. Faster as possible, in the limit of autoit.

3) Move a folder and its content inside a .xyz file

4) Extract a folder and its content from .xyz file

For this reason i have think to use the .tar, no compression and is just a container. But doesn't exist actually a UDF that use .tar and meet point one. But i don't care the file format, i have think to .tar but can be anything.

Edited by MyEarth

Share this post


Link to post
Share on other sites

If you just need a container without compression I suggest this UDF:

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Very cool! But there are a couple of big problems.

1) It works on file so i lost the folder structure, and that's the main problem

2) Don't move but copy the file inside the container, i need a "cut" operation

Is very similar to my goal but i need the folder tree structure...

Share this post


Link to post
Share on other sites

This ZIP UDF seems to use a DLL that is part of the Windows System.

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Sorry if I seem annoying but it use compression...but many thanks for the effort, i'l really apprecciate it

Share this post


Link to post
Share on other sites

MyEarth,

So you want a container which holds a folder tree structure - the OS already gives you that, it is called a folder!

Or are you really asking for a way to hide the structure inside a folder? If so, how do you expect to be able to access it yourself? And why do you need to do this in the first place?

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hello. as soon I can understand You could probably do something like Building your own file format and using FIlelisttoarrayRec and File write/read.

 

Basically You create a File Header base in FileListToArrayRec use some indexs(for easy find your files data in your file) and write files append to your own format.

 

Saludos

 

 

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

I think you could use the "MakeCAB" and "EXTRACT" dos commands.

p.s.
don't ask me how to use those commands....  :D

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

@Chimp MAKECAB work only for files

@Danyfirex in theory, but pratically? How to preserve folder structure? How to move instead of copy?

@Melba23 Folder <> File or software like 7-Zip and others who invented them to do? :)

Edited by MyEarth

Share this post


Link to post
Share on other sites

@MyEarth you dont know what you want, do you? software like 7-Zip copies files to archive and compresses them and you said you dont want that, but still you are mentioning 7-zip as example. Sounds like contradiction to me...

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

@kosamja Yeah i know what i want thanks, read post #5 if you don't.

7-Zip, i have mention it only ONCE and i can't use since i need an internal solution, can store the folder-file without compress. Every "compression software" can store the file without compress. TAR file is the same.

Edited by MyEarth

Share this post


Link to post
Share on other sites

You could always embed a dll in your code, and then run it from there.
There are several examples in the "Autoit Example Scripts" forum.
I pretty sure thats as close as you are gonna get.

All you need is a container. Pick one.

Zip, Rar, 7zip, Tar, etc.

By the way, you could also use a "Virtual Disk Drive" as a container.
It's a file that works just like a hard drive.

ImDisk is one of them.

Download here:
http://imdisk.en.lo4d.com/


Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites
13 hours ago, MyEarth said:

 ... MAKECAB work only for files ...

... wrong answer ...

If you use MakeCAB in the right way, you can store files and subdirectory information so that when you extract files using the expand command (expand -R -F:* mycab.CAB mydir) , those files are saved in the specified directory, recreating the tree path. (You can also create autoextracting files)

From a quick search I see that a fast way to use is by creating a text file( with .ddf extension) containing directives for the MakeCAB command. You will execute MakeCAB with /F parameter followed by your directives file and MakeCAB will perform what you asked within the directive file.
makecab /F directives.ddf

Have a look to the following link for an example on how to specify the destinations paths for the files (.Set DestinationDir): http://dataerror.blogspot.it/2005/10/makecab-part-3-compress-multiple-files.html

... maybe, you could use the _FileListToArrayRec AutoIt function as a base to create a "directive" file for th MakeCAB command....


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

Actually, after some thought on the matter, it shouldn't be
too difficult to create your own container in pure Autoit.

Using _FileListToArrayRec() to get a list of files, then Base Encode the
files into a container with a unique marker for the path and filename.

Something like this inside the file container...

### C:\temp\somefile1.txt
(Base Encoded file here)
### C:\temp\somefile2.txt
(Base Encoded file here)
### C:\temp\somefile3.txt
(Base Encoded file here)

To reverse, extract using the markers, then Base Decode and write to their perspective paths.

I will have to play with it some over the weekend, maybe.
But I don't think I would have a use for it.
I'm satisfied with using zip or rar.


- edit -
If you don't care about the size of the container, you could use Binary instead of Base Encode.
But, it would be twice the size of the files.

Edited by ripdad

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now