Jump to content
Macro Express Forums

Check Drive Space


sparkcity
 Share

Recommended Posts

I was running ms money and didn't realize the thumb drive(128M) was filling up.

It filled up with money open and it crashed. Lost 3 months of data i had to re-enter. :(:angry:

Is there a function in ME that reports the free space left on a given drive??

Love this program, best money i ever spent on software. :D

Sparks

Link to comment
Share on other sites

Not that I know of but that's something I would like to know so I’ll have to watch this thread. I’ve never considered it but in some of my routines it would be beneficial to check first to make sure there is enough room.

 

The only thing I could think of would be to create a batch file to do a directory listing of the drive and write it to file. E.g. “dir f: /-c >filesize.txt”. The “/-c removed the thousands separators. Read the second to the last line to get the free space and figure out a clever way to eliminate all but the size.

 

Or you could have ME recursively list all the files on the drive and sum the file sizes. Assuming you already know the size of the device you could subtract the sum of all the files from the devices size.

 

Also you could simply try to copy the file to the disk and after the command check to see if it made it before deletion. If it didn’t display an error and don’t delete the file.

Link to comment
Share on other sites

I did not try the macro but I tried this manually:

 

I typed "DIR /-C" at a command prompt on my Windows XP Pro, Windows XP Home and Windows 2000 Server systems. The commas were removed in all three cases.

 

But, "DIR /-C" at an MS-DOS prompt on a Windows 98 virtual session did not remove the commas.

 

Randall: I forget, what version of Windows are you using? Also, are you using a non-US English version? What happens when you manually type "DIR /-C" at a command or MS-DOS prompt?

 

Cory: This is a great tip that I was not aware of. I'm glad to learn about it.

Link to comment
Share on other sites

Here is a complete list of the DIR command switches and what they mean ... well at least as far as Windows XP is concerned:

 

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
[/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

 [drive:][path][filename]
       Specifies drive, directory, and/or files to list.
 /A    Displays files with specified attributes.
         D  Directories                R  Read-only files
         H  Hidden files               A  Files ready for archiving
         S  System files               -  Prefix meaning not
 /B    Uses bare format (no heading information or summary).
 /C    Display the thousand separator in file sizes.  This is the
       default.  Use /-C to disable display of separator.
 /D    Same as wide but files are list sorted by column.
 /L    Uses lowercase.
 /N    New long list format where filenames are on the far right.
 /O    List by files in sorted order.
         N  By name (alphabetic)       S  By size (smallest first)
         E  By extension (alphabetic)  D  By date/time (oldest first)
         G  Group directories first    -  Prefix to reverse order
 /P    Pauses after each screenful of information.
 /Q    Display the owner of the file.
 /S    Displays files in specified directory and all subdirectories.
 /T    Controls which time field displayed or used for sorting
         C  Creation
         A  Last Access
         W  Last Written
 /W    Uses wide list format.
 /X    This displays the short names generated for non-8dot3 file
       names.  The format is that of /N with the short name inserted
       before the long name. If no short name is present, blanks are
       displayed in its place.
 /4    Displays four-digit years

Switches may be preset in the DIRCMD environment variable.
Override preset switches by prefixing any switch with - (hyphen)--for example, /-W.

You can see that the /-C switch just turns commas off.

Link to comment
Share on other sites

Hi, kevin, Floyd,

Yes, Win XPSP2

I have found the problem, I think; all working now; the macro did not prompt for non-existent initiation folders, and dos did not tell me the error.

/-c works from dos and the macro.

The macro also made no allowance for quotes if required in the dos command (say, "%T3%" might be "InstallPath", for instance)

Best, Randall

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...