Copy file from windows to linux without Modifying file timestamp using SAS - linux

I want to copy excel file file from windows to Linux system and need to capture last modified date of the file.
We cant take take last modified date of the file from windows.
Since i am using below code to copy file from Windows to Linux, Code is able to transfer file to Linux system however once after running the code the timestamp of the file is changing. Is there any way to copy file from windows to linux without modifying file timestamp. Please help.
%smb_init(username=**MYID**, password=%str(**password**), domain=**aa.aaa.com**);
%smb_load();
%smb_pull(windows=//files/Load/Test/Folder1/PIC Alerts/ABC Alerts.xlsx,
linux=/sasdata/test_files/folder2/ABC_Alerts.xlsx);

If you would like to copy files while preserving attributes, enable X commands in SAS and let the OS handle copying files. After enabling it, it's as simple as using a built-in Linux file copying command like rsync.
For example, this will copy data, attributes, and timestamps:
rsync -av //source/mydata.xlsx /dest/mydata.xlsx
Once you confirm it works as expected, you can build it into your SAS program and pass it to Linux:
x 'rsync -av //source/mydata.xlsx /dest/mydata.xlsx';
The automatic macro variable &sysrc will tell you if it was successful. A value of 0 means success. Non-zero means failure.

Related

File extracted on windows and then copied to linux - any issue in file format on LINUX

Wanted to understand if a zip file is extracted on windows and then extracted files are copied (WINSCP) to LINUX machine.
l there be any issue on Linux related to file format ?
scp does not transform the file in any way; there is no difference between extracting the file on one system and transferring it to the destination system via scp versus extracting the file directly on the destination system (assuming no transfer errors occur).

Linux bash to compare two files but the second file must be find

I have a batch that integrates an xml file time to time but could happens daily. After it integrates it puts in a folder like /archives/YYMMDD(current day). The problem is if the same file is integrated twice. So I need a script what verifys the file (with diff command its possible but risky to make a bottleneck) but the problem is I can't find to resolve how to make to give the second files location.
P.S. I can't install on the server anything.
Thanks in advance.

How to prevent a compiled batch file store source in tmp?

I need a batch file compiler that doesnt leave the source in %tmp%, so it cant be cracked that way. If there isnt a compiler that can do that, is there a way to prevent it? I have tried AbyssMedia QBFC, but it just makes the file hidden.
I agree with Hackoo: This can't be done.
A batch file is a Windows command script. Like all scripts being just a text file, also batch files need an interpreter for execution which is the Windows command processor cmd.exe for all versions of Windows NT (NT4, 2K, XP, Vista, ...).
All bat-to-exe converters simply embed the batch file compressed or even uncompressed into an executable. The created executable extracts the batch file into directory for temporary files and execute it as process resulting in being interpreted with cmd.exe.
So what all those bat-to-exe tools do can be done for example also with WinRAR by creating a self-extracting RAR archive which on execution extracts the batch file (and other added files) automatically into temporary files directory and executes the batch file which as last line deletes itself.
In other words bat-to-exe tools are completely useless tools in my point of view. SomethingDark is right: bat-to-exe converters are garbage.

Corflags.exe cf001 Could not open file for wiriting

I am trying to edit the corflags file so that I can run 32bit applications on a 64 bit pc but everytime I try to edit the file using something like corflags.exe assembly /32bit+ it comes up with the error message cf001 could not open file for writing.
Now I have tried a lot of different options such as:
Running in administrator mode;
Finding the file using a search and checking read only is not ticked
Checking that user full control is ticked
Tried to set the whole folder to non read only
When trying the whole folder, it goes through looking like it has set read-only, but then I click OK and re-right click on the whole folder, the box is filled in (not ticked) does this mean that part of the folder is read only and why does it reset to read only?
I just faced the same problem and have tried the same things.
Run cornflags from an elevated ("Run as administrator") Visual Studio Command Prompt. I did the same for a copy of the original .exe just to make sure no other process was using the program.
Create a copy of the file you intend to target with CorFlags.
(e.g. "WcfServiceHost.exe" --creates--> "WcfServiceHost - Copy.exe")
Rename the original file to something else:
(e.g. "WcfServiceHost.exe" --> "WcfServiceHose_Original.exe")
Rename to copy to the original file name
(e.g. "WcfServiceHose - Copy.exe" --> "WcfServiceHost.exe"
For my purposes, I created copies and named them describing their configuration:
Example:
WCFServiceHost_With32BitOn.exe
WCFServiceHost_With32BitOff.exe
Now I can destroy the WCFServiceHost.exe files and create them from these pre-modified copies. No more CorFlags operations necessary.
Note: this is basically a more verbose version of #RMalke answer and that answer should be marked as the answer.
I realise this is years later, but for anyone else looking, I found that the quickest way was to copy cmd and corflags.exe into the same folder as the one you want to edit. Then run cmd as admin from there.

Apply exact stat parameters from one file to another using C in Linux

I would like get stat parameters from one file and later apply it as is, to a copy of the same file (Including type, path, permissions, size, etc.).
The original file will be long gone from this directory and the copy will take his place, and should get the same exact properties.
How could this be done using C in Linux?
If I understand your question correctly, you don't need to write your own program to do that.
If your files reside on the same machine, you can preserve and restore times and permissions in tar archives. The p option handles permissions, and times are persisted by default (except atime, but --atime-preserve can work around that).
Alternatively, if you want to restore files from a remote server, you can use rsync with the -a option.

Resources