I often drop Excel files locally from my company's file server.
It is prohibited to view files directly on the server, so I need to drop them locally, but it is troublesome to go to see and copy the server every time, so I wanted to run the program and download it automatically.
·The address of the server starts with smb://
·The files you want to download are mainly Excel files
·Copy (overwrite) the file specified in the program execution from the server to the desktop
Is this possible?Also, which language is easier?
If possible, Node.js and Python will not need to create a new environment, so that's better, but anything is fine.
I look forward to hearing from you.
network smb
PowerShell comes standard with Windows.
The reference is in English.
Copy-Item
There is an explanatory article like this.
How to transfer files in WinRM using PowerShell's Copy-Item cmdlet
If not, enable Windows PowerShell 2.0 in the Control Panel, Uninstall Programs, Enable or Disable Windows Features, or download a newer version of the package from Microsoft Download Center and install it.
The number of versions available for installation may vary depending on the number of OS versions used, but the latest version seems to be 6.0.
If you search for it, you will find various articles on how to use it.
According to the comments, it looks like a mac, but now it is supported on mac and Linux, so
You can probably use it the same way.Whether you want to use it or not is up to your liking.
Install PowerShell Core on macOS
Installing PowerShell Core on Linux
-Serial 】Introduction to PowerShell Core 【How to use basic commands 回7th 、Create, delete, copy, and move files and directories
Tried a cross-platform PowerShell on Mac OS X
Pre-specified Files
So the file name is fixed.
Suppose you are in the path smb://hoge-server/share/sample.xlsx
.
In this case,
copy\\hoge-server\share\sample.xlsx sample.xlsx
You can create a one-line BAT file, save it on your desktop with a name like copy_xlsx.bat
, and double-click it whenever you need it.
This way, unlike PowerShell, you don't need to give extra privileges when you run it for the first time.
However, if the file path contains Japanese, this method is not available because it will be treated as Missing Source File.
© 2024 OneMinuteCode. All rights reserved.