{"id":69,"date":"2023-03-03T09:39:24","date_gmt":"2023-03-03T09:39:24","guid":{"rendered":"https:\/\/smartsource.com.sg\/blog\/?p=69"},"modified":"2023-03-03T09:39:24","modified_gmt":"2023-03-03T09:39:24","slug":"script-to-copy-a-file-remotely-using-winscp","status":"publish","type":"post","link":"https:\/\/smartsource.com.sg\/blog\/index.php\/2023\/03\/03\/script-to-copy-a-file-remotely-using-winscp\/","title":{"rendered":"Script to copy a file remotely using winscp"},"content":{"rendered":"\n<p>Create a shell script and copy the below code to the file. Later you can run this script to execute the commands automatically<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#command to connect to the remote server using winscp\nwinscp  sftp:\/\/username:password@serveripordomain\/ -rawsettings SendBuf=0\n\n#tar and zip a folder before copying it. use --exclude to exclude files\ncall tar -czf archive15dec2022.tar.gz \/path\/to\/folder\/youwanttocopy\n\n#get the file to your local pc\/server and deleting it from the remote server\nget -delete archive15dec2022.tar.gz \n\n#below command to remotely zip a mysql database and get the sql file\ncall mysqldump -umysqluser -pmysqlpassword dbname > archive15dec2022.sql\nget -delete archive15dec2022.sql\n\nexit\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Create a shell script and copy the below code to the file. Later you can run this script to execute the commands automatically<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[49,50,48],"class_list":["post-69","post","type-post","status-publish","format-standard","hentry","category-howtos","tag-mysql","tag-remote","tag-winscp"],"_links":{"self":[{"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/posts\/69","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=69"}],"version-history":[{"count":1,"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/posts\/69\/revisions"}],"predecessor-version":[{"id":70,"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/posts\/69\/revisions\/70"}],"wp:attachment":[{"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=69"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=69"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smartsource.com.sg\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=69"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}