Giter Site home page Giter Site logo

Comments (5)

PrzemyslawKlys avatar PrzemyslawKlys commented on May 26, 2024

Sorry for the late response. I haven't had a chance to test it. But doing it manually file by file (with Recursive switch on Get-ChildItem) with CreateRemoteDirectory should work properly.

from transferetto.

Mahmoud87 avatar Mahmoud87 commented on May 26, 2024

from transferetto.

PrzemyslawKlys avatar PrzemyslawKlys commented on May 26, 2024

by manually I mean you can write some additional code that should help you. It shouldn't be more than 20 lines of code to do it.

from transferetto.

Mahmoud87 avatar Mahmoud87 commented on May 26, 2024

by manually I mean you can write some additional code that should help you. It shouldn't be more than 20 lines of code to do it.

Hi mate, I am trying but I am seeing different results, so I have started with few lines and uploading directories. Here is the script.

`
$Client = Connect-FTP -Server 'ftp://caqq.com' -Verbose -Username '67p' -Password 'avv33'

$sourceFolder = 'F:\New folder\2695 NSW'
$ListFiles = Get-ChildItem $sourceFolder -recurse -File -ErrorAction SilentlyContinue
$LocalDir = Get-ChildItem $sourceFolder -Directory

Foreach ($Dir in $LocalDir){
Send-FTPDirectory -LocalPath $Dir.fullname -Client $Client -RemotePath "/x11/xx/Test/Test" -Verbose

Write-Host "Uploading" $Dir

Start-Sleep -Seconds 2
}
Disconnect-FTP -Client $Client
`

When I list my $localdir this is what I get;
Directory: F:\New folder\2695 NSW

Mode LastWriteTime Length Name


d----- 24/08/2021 5:00 AM 13 Trelawney ADD
d----- 23/08/2021 8:29 PM Acoustic Report
d----- 23/08/2021 8:29 PM Architectural Drawings
d----- 24/08/2021 5:23 AM Architectural Schedules
d----- 23/08/2021 8:29 PM COSTING TOOL
d----- 23/08/2021 8:29 PM Electrical Services
d----- 23/08/2021 8:29 PM Hydraulic Services
d----- 23/08/2021 8:29 PM Lift Services
d----- 23/08/2021 8:29 PM Mechanical Services
d----- 23/08/2021 8:29 PM PPR
d----- 23/08/2021 8:29 PM Woollarah Embassy

When I check the FTP server
This is what gets uploaded from the $localdir
Addendum 01
Addendum 02
Documents
OLD TOOL
2uasdjjklaf.pdf
Directorytest.txt
WINPE10.0-DRIVERS-A23-PR4K0.CAB

The first 4 folders are actually subfolders, and the files on the root of $localdir, which I have no idea why they have got uploaded, since I haven't started to upload any files yet!!?

I will be very grateful if you could help me out.

from transferetto.

Mahmoud87 avatar Mahmoud87 commented on May 26, 2024

by manually I mean you can write some additional code that should help you. It shouldn't be more than 20 lines of code to do it.

Hi mate, I am trying but I am seeing different results, so I have started with few lines and uploading directories. Here is the script.

`
$Client = Connect-FTP -Server 'ftp://caqq.com' -Verbose -Username '67p' -Password 'avv33'

$sourceFolder = 'F:\New folder\2695 NSW'
$ListFiles = Get-ChildItem $sourceFolder -recurse -File -ErrorAction SilentlyContinue
$LocalDir = Get-ChildItem $sourceFolder -Directory

Foreach ($Dir in $LocalDir){
Send-FTPDirectory -LocalPath $Dir.fullname -Client $Client -RemotePath "/x11/xx/Test/Test" -Verbose

Write-Host "Uploading" $Dir

Start-Sleep -Seconds 2
}
Disconnect-FTP -Client $Client
`

When I list my $localdir this is what I get;
Directory: F:\New folder\2695 NSW

Mode LastWriteTime Length Name

d----- 24/08/2021 5:00 AM 13 Trelawney ADD
d----- 23/08/2021 8:29 PM Acoustic Report
d----- 23/08/2021 8:29 PM Architectural Drawings
d----- 24/08/2021 5:23 AM Architectural Schedules
d----- 23/08/2021 8:29 PM COSTING TOOL
d----- 23/08/2021 8:29 PM Electrical Services
d----- 23/08/2021 8:29 PM Hydraulic Services
d----- 23/08/2021 8:29 PM Lift Services
d----- 23/08/2021 8:29 PM Mechanical Services
d----- 23/08/2021 8:29 PM PPR
d----- 23/08/2021 8:29 PM Woollarah Embassy

When I check the FTP server
This is what gets uploaded from the $localdir
Addendum 01
Addendum 02
Documents
OLD TOOL
2uasdjjklaf.pdf
Directorytest.txt
WINPE10.0-DRIVERS-A23-PR4K0.CAB

The first 4 folders are actually subfolders, and the files on the root of $localdir, which I have no idea why they have got uploaded, since I haven't started to upload any files yet!!?

I will be very grateful if you could help me out.

Please ignore this one, I got it fixed by adding "$($Dir.Name)" at the end of -RemotePath "/x11/xx/Test/Test" and it's working so far doing some testing for the files :)

from transferetto.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.