How to copy a file without extension and at the end of the copy put it? - vb.net

I am using teracopy to move some files. I would like to make a form in visual * .exe where you simply have two windows: one with the file's origin on the right, and another with the file's destination.
I need to copy the file without its extension, verify that the transfer occurred without issue, and then restore the original extension. For example:
Copy file.mov to // smb: Storage / Movies /
Remove the .mov extension
Copy the file to the storage location
Validate file size
If the file size at the destination matches the source, restore the .mov extension
If the file size doesn't match, delete the destination file and notify the user of the error.
The files I plan to copy are very large, and will take a good amount of time. I'm removing the extension so that users on the server will not accidentally try to access a file that isn't completely transferred yet - the idea is they see an "extensionless" file and know not to try and open it, whereas any files with extensions are certain to have copied over correctly.
I've tried using CMD and powershell, but I've only managed to copy the file or retry copying if the copy fails. I don't yet know how to remove the extension and restore it.
> ROBOCOPY /Mir <Source> <Target>

You can try this:
copy %UserProfile%\YourFile.* "Path to copy to"

Related

Vba do not open wbook

There isn't enough memory to complete this action" in Excel
How to fix it without opening file
İ want to turn calculation manual but without open it is impossible
In order to change the automatic calculation to manual without opening the .xlsx file, you can do this. Before doing this, be sure to make a copy of the file and try these manipulations on the copy.
Unzip the .xlsx as a .zip archive, open the file ...\xl\workbook.xml in a text editor, find a tag similar to the following <calcPr calcId="191029"/> and add to it calcMode="manual" so you get <calcPr calcId="191029" calcMode="manual"/>. Then save this file, package the entire directory, and change the extension to .xlsx.

Excel on Mac. Cannot open IQY file in Data/Get External Data/Run Web Query

I am running Excel version 16.45 on Mac.
I have created a .iqy and saved it in the Queries directory alongside certain templates which were already there.
I go to Data/Get External Data/Run Web Queries. While the templates are accessible, my file is visible but greyed out (same thing happens if I save the file in a different directory).
Would anyone be able to help?
According to your information, I would like to confirm whether the issue occurs when you follow the steps as below:
1.Create a Word file, paste the web URL.
2.Save the Word as .iqy with .txt format.
3.Choose MS-DOS as coding.
4.Create an Excel file and click "Data >Get External Data >Run Web Query (Or Run Saved Query) " of the Bar
I was able to address the issue as follows.
When navigating to the relevant directory with Finder, the '.iqy' file appears to be appropriately named (as per Image 1).
In fact, if you reach the file in Terminal, the file is saved as '.iqy.txt'.
So all I had to do is rename the file, simply removing the '.txt' string at the end.
Screen you see when navigating in Finder

Reopen DOC file in write mode, with macro inside it

I am using a macro template for particular DOC files only. It runs only for these files and, as I assume, it is treated as the DOC file itself.
All I want is to remove the file OR clear the contents of it, after the macro finishes. The initial file is read-only.
I have tried:
SavingAs in TEMP folder, change file attribute of initial file and then try to Kill it - no luck, it seems that initial file is still preloaded(?) and does not know that the read-only flag was removed. Error: Permision denied.
When I try to Close the initial document, I am closing also the macro itself...
So:
Is there any way to (from the macro inside the DOC file) :
Reopen the file in write-mode? (so I could clear the contents afterwards)
Remove the initial file? (after SaveAs so I actually will have a new file in write-mode and will be able to remove initial file)

Edit source code of Impress odp file

I want to edit the source code of an Impress file (.odp) but when I open it is just machine coded.
I want to do it because when I converted files from PowerPoint to an Impress File some parts got mixed up. Like for example footer and numbering can't be changed globally. So by editing the source code, I hope to be able to use find/replace in a Text Editor.
LibreOffice formats are zipped archives primarily containing XML files. So unzip the .odp and then edit content.xml.
When finished, zip it back up, making sure to zip it from the correct directory (the one that contains content.xml).
Documentation: https://help.libreoffice.org/Common/XML_File_Formats#XML_file_structure.
If you are using a Mac do the following:
Change the .odp extension to .zip by manually clicking the icon and renaming the file
Unzip the file using something other than the standard Archiver (I used Keka)
You will see the folder of contents including the content.xml which you can easily edit now
Crucial: Go into the directory with your separate files, select all the files then hit 'compress' from the options menu when you right click
Next, rename the .zip to .odp and the file will open successfully
I found that if you don't do option 4 above exactly then the file is slightly different and won't open due to a corruption message.

Problems overwriting file in application folder

I have a file called PolicyLookup.sql that sits in my application's root folder. My app loads this file into a text box, so that users can edit it and overwrite the original file by pressing a save button. This all worked perfectly during test, however after deployment users are unable to save the file due to write issues within C:\Program Files.
Is there a way around this - or is there a better way to implement this type of thing? One solution that springs to mind for me is placing the contents of the PolicyLookup.sql file within a User Setting - however it intrinsically feels wrong to me to put the entire contents of a file within a settings variable.
Ordinary users do not have write permissions on %ProgramFiles%. If you need to save a configuration file then put it in a subfolder of %APPDATA% (which for me is C:\Users\Gord\AppData\Roaming) or some other place where a regular user is allowed to write.