Jump to content

"Convert" folder to file


MyEarth
 Share

Recommended Posts

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
Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

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
Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
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...

Link to comment
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 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

 

 

Link to comment
Share on other sites

@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
Link to comment
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/

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
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....

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

Link to comment
Share on other sites

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

"The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...